A company stores a mapping of users to cost centers in an Amazon RDS database. The company needs to ensure that every resource created in a particular AWS account is tagged with the cost center ID of the user who created it. Which solution meets this requirement?
Choose an answer
Tap an option to check your answer.
Correct answer: Create an AWS Lambda function that looks up the appropriate cost center in the RDS database and tags the resource. Configure an Amazon EventBridge rule that reacts to AWS CloudTrail resource-creation events to invoke the Lambda function..
Why this is the answer
This solution effectively automates tagging. When a resource is created, CloudTrail logs the event. EventBridge can then detect this specific CloudTrail event and trigger a Lambda function. The Lambda function can query the RDS database to retrieve the correct cost center ID for the user who initiated the resource creation and then apply that tag to the new resource. This ensures immediate and accurate tagging based on the user's cost center.
Incorrect options:
SCPs enforce policies but cannot dynamically query a database and apply tags based