Certopolis

AWS Certified Developer – Associate

Bedrock model access, API keys and invocation logging: DVA-C03

According to the Amazon Bedrock User Guide, most models are enabled on first use if the caller has AWS Marketplace permissions, and an IAM policy or SCP that denies bedrock:InvokeModel blocks inference. Short-term API keys are recommended for production. Model invocation logging is off by default and writes to CloudWatch Logs or Amazon S3.

Model access and how to deny it

In commercial Regions there is no access request to submit for most models. The first invocation of a third-party model starts an AWS Marketplace subscription in the background, which can take up to 15 minutes. That first caller needs aws-marketplace:Subscribe, aws-marketplace:Unsubscribe and aws-marketplace:ViewSubscriptions. Once the model is enabled for the account, callers no longer need Marketplace permissions.

Some Anthropic models also need first-time use case details, submitted once per account or once at the organization's management account, in the console or with PutUseCaseForModelAccess.

To block inference on a model, deny the actions that invoke it on that model's ARN. The same policy can be used as a service control policy across an organization. Denying bedrock:InvokeModel also blocks Converse and StartAsyncInvoke. To be explicit, use bedrock:InvokeModel* or add bedrock:Converse and bedrock:ConverseStream.

Short-term vs long-term Bedrock API keys

A Bedrock API key is a bearer token used instead of AWS credentials. Set it in AWS_BEARER_TOKEN_BEDROCK or send it in the Authorization header.

A short-term key lasts up to 12 hours or the length of the session, whichever is shorter, and inherits the permissions of the principal that generated it. AWS recommends it for production. A long-running application calls the token generator before each request and gets a cached token or a fresh one.

A long-term key lasts until a set expiration date, creates an IAM user, and is recommended only for exploration. If one leaks, deactivate it with UpdateServiceSpecificCredential and Status=Inactive, or reset or delete it. iam:CreateServiceSpecificCredential controls who can create long-term keys, and the iam:ServiceSpecificCredentialAgeDays condition key caps their lifetime. bedrock:CallWithBearerToken controls who can use a key.

Invocation logging and private connectivity

Model invocation logging captures the full request, response and metadata for Converse, ConverseStream, InvokeModel and InvokeModelWithResponseStream calls in an account and Region. It is disabled by default. Destinations are CloudWatch Logs and Amazon S3, and they must be in the same account and Region. JSON bodies up to 100 KB are logged inline. Larger bodies and binary data such as images go to S3.

An interface VPC endpoint gives private access with no internet gateway or NAT device. Each API family has its own service name: bedrock, bedrock-runtime, bedrock-agent and bedrock-agent-runtime. With private DNS enabled, code needs no change. The default endpoint policy allows full access, so attach a custom endpoint policy to limit actions or models.

Managing access to AI services, private connectivity with VPC endpoints and protecting log content are skills in Task 2.3 of the exam guide, a task that AWS lists as new in DVA-C03.

Where the exam catches people

  • Believing long-term Bedrock API keys are the production choice: actually AWS recommends short-term keys for production and long-term keys only for exploration.
  • Believing a deny on bedrock:InvokeModel leaves the Converse API usable: actually Converse is blocked automatically when InvokeModel is denied.
  • Believing model invocation logs can be delivered to a bucket in a central logging account: actually the destination must be in the same account and Region.
  • Believing a new interface endpoint limits which models can be called: actually its default policy allows full access until you attach a custom one.
  • Believing every role that invokes a third-party model needs Marketplace permissions: actually only the caller that first enables the model for the account does.

Written from these sources

Try 3 questions on this

Pick an answer to see why each option is right or wrong.

  1. A company must stop every principal in its organization's member accounts, including principals that are created later, from running inference on one foundation model in Amazon Bedrock. Other models must stay available. Applications call that model through the InvokeModel and Converse APIs and through batch inference jobs. Which solutions will meet these requirements? (Select TWO.)

    Right. In the game that’s Renown for your Security building.

    Not that one: A,C is right. In the game your Security building would lose a little Renown, and this question would come back later.

    Show the full explanation and doc quotes

    Listing bedrock:InvokeModel* together with Converse, ConverseStream and CreateModelInvocationJob is the documented explicit form, so either policy alone blocks the model and leaves other models untouched.

    Written from docs.aws.amazon.com/bedrock/latest/userguide/security_iam_id-based-policy-examples.html

  2. A developer is moving an AWS Lambda function that calls the Amazon Bedrock Converse API with an API key from a test account to production. In production, the function runs under its execution role, and the company uses the type of Amazon Bedrock API key that AWS recommends for production workloads. Which solution will meet these requirements?

    Right. In the game that’s Renown for your Security building.

    Not that one: A is right. In the game your Security building would lose a little Renown, and this question would come back later.

    Show the full explanation and doc quotes

    Calling the token generator before each request from the execution role returns a cached token while it is valid and a fresh one when it is not, and the token is sent as a bearer token in the Authorization header.

    Written from docs.aws.amazon.com/bedrock/latest/userguide/api-keys.html

  3. A security team must be able to review the full prompt and response text of every Converse call that an application makes to Amazon Bedrock in us-east-1. The records must be stored in the company's account and must be searchable with CloudWatch Logs Insights. Which solution will meet these requirements?

    Right. In the game that’s Renown for your Security building.

    Not that one: A is right. In the game your Security building would lose a little Renown, and this question would come back later.

    Show the full explanation and doc quotes

    It is disabled by default, and its destinations, CloudWatch Logs and Amazon S3, must be in the same account and Region. A CloudWatch Logs destination makes the records searchable with Logs Insights.

    Written from docs.aws.amazon.com/bedrock/latest/userguide/model-invocation-logging.html

Ask for something