Certopolis

AWS Certified Generative AI Developer – Professional

Amazon Bedrock model invocation logging for AIP-C01

Model invocation logging records the full request, response and metadata of Converse, ConverseStream, InvokeModel and InvokeModelWithResponseStream calls in one account and Region. It is off by default and writes to CloudWatch Logs, S3 or both, in the same account and Region only. Content that a guardrail blocks still appears in plain text in these logs.

What it captures and where

Logging covers calls on the bedrock-runtime endpoint. You choose which modalities to log: text, image, embedding and video. Destinations are CloudWatch Logs, S3, or both. Only destinations in the same account and Region are supported, and an S3 bucket must be in the same account and Region as the logging configuration.

In S3, logs arrive as gzipped JSON files. In both destinations, input and output bodies up to 100 KB are inside the log record. Larger bodies and binary data go to S3 under a data prefix. You configure logging with PutModelInvocationLoggingConfiguration.

Central collection and retention

Because the destination must be in the same account, a multi-account setup logs to a bucket in each application account and then uses S3 replication to a central bucket. Replication needs versioning on the source and destination buckets, and the destination owner must grant the source owner permission in a bucket policy.

For records that no one may delete for a fixed time, write logs to a bucket with S3 Object Lock and a default retention period in compliance mode. In compliance mode no user, including the root user, can overwrite or delete a protected object version, and the retention period can't be shortened. After the period ends, the objects can be deleted.

Logging and guardrails

All content blocked by guardrail policies appears in plain text in model invocation logs if logging is enabled. Blocking a prompt that contains a card number does not keep the number out of the log. AWS's stated option is to disable invocation logging if you do not want blocked content stored in plain text.

Where the exam catches people

  • Believing each account can log straight to a central bucket in another account: destinations must be in the same account and Region, so replicate from a local bucket.
  • Believing a guardrail block keeps the blocked text out of the logs: blocked content appears in plain text in invocation logs.
  • Believing a deny bucket policy or MFA delete stops the root user deleting logs: S3 Object Lock in compliance mode does.
  • Believing invocation logging is on by default: it is disabled until you configure it.
  • Believing encrypting the log bucket meets a rule that card numbers must not be stored: the numbers are still stored, only encrypted.

Written from Amazon Web Services's documentation

Try 3 questions on this

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

  1. A bank uses an FM on Amazon Bedrock to draft replies to customer complaints. Model invocation logging delivers every prompt and response to an Amazon S3 bucket. A financial regulator requires the bank to keep these records for 7 years. During the 7 years, no user in the account, including administrators and the root user, can be able to delete or overwrite a log object. After 7 years, the bank must be able to delete the records. Which solution will meet these requirements?

    Right. In the game that’s Renown for your AI Safety, Security, and Governance building.

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

    Show the full explanation and doc quotes

    It adds that the object's "retention mode can't be changed, and its retention period can't be shortened." A default retention period on the bucket applies the lock to every log object that invocation logging writes, and the lock ends when the retention period does, so the records can be deleted after 7 years.

    Written from docs.aws.amazon.com/AmazonS3/latest/userguide/object-lock.html

  2. A company runs GenAI applications that call the Converse API in three AWS application accounts, all in us-east-1. The security team keeps all audit data in a central Amazon S3 bucket in a separate log archive account, also in us-east-1. The team must collect the full request data and response data of every model invocation from the three application accounts in the central bucket. The solution must not use custom code. Which combination of steps will meet these requirements? (Select TWO)

    Right. In the game that’s Renown for your AI Safety, Security, and Governance building.

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

  3. A bank runs one customer assistant in its AWS account. The assistant calls the Amazon Bedrock Converse API with a guardrail that has a sensitive information filter. The filter blocks every prompt that contains a credit card number, and the user then receives the blocked message. Model invocation logging is turned on and delivers logs to Amazon S3. The bank uses these logs only for occasional troubleshooting. A new policy states that no credit card number that a user types may be stored in any Amazon Bedrock log. Which solution will meet these requirements?

    Right. In the game that’s Renown for your AI Safety, Security, and Governance building.

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

    Show the full explanation and doc quotes

    Blocking a prompt does not stop the logging of what was blocked. The same note gives the remedy: "You can disable Amazon Bedrock Invocation Logs if you do not want your blocked content to appear as plain text in the logs." The bank uses the logs only for troubleshooting and runs one assistant, so turning logging off meets the policy.

    Written from docs.aws.amazon.com/bedrock/latest/userguide/guardrails-components.html