A company stores an API key for a third-party billing platform in AWS Secrets Manager. To comply with security policies, the API key must be rotated automatically every 30 days. A SysOps administrator creates a custom AWS Lambda function to perform the rotation and deploys it in a private subnet of a VPC. When the administrator attempts to enable automatic rotation, the rotation fails. Which configurations are required to resolve this issue and successfully rotate the secret? (Select TWO.)
- Add a resource-based policy to the Lambda function that grants the lambda:InvokeFunction permission to the secretsmanager.amazonaws.com service principal.Answer
- Configure the route table of the Lambda function's private subnet with a route to a NAT gateway to enable outbound internet access to the billing platform.Answer
- CAttach an IAM policy to the Lambda function's execution role that grants the secretsmanager:RotateSecret permission.
- DConfigure the Lambda execution role with the iam:PassRole permission to allow AWS Secrets Manager to assume the execution role during rotation.
- EConfigure a VPC Gateway Endpoint for the third-party billing platform's domain and associate it with the private subnet's route table.
Answer
Grant the Secrets Manager service principal permission to invoke the Lambda function using a resource-based policy, and configure the private subnet's route table with a route to a NAT gateway to allow outbound internet access.
To successfully execute a custom rotation, the AWS Secrets Manager service principal must be granted lambda:InvokeFunction permissions on the Lambda function via a resource-based policy. Furthermore, since the Lambda function is situated in a private subnet and must reach a public third-party SaaS API endpoint to update the credentials, the subnet's route table must route internet-bound traffic through a NAT gateway located in a public subnet.
Step-by-Step Solution
Key Concept
Configuring AWS Secrets Manager custom rotation for non-AWS services requires both a Lambda resource-based policy allowing invocation by the Secrets Manager principal and a valid network routing path (such as a NAT gateway) for the VPC-bound Lambda function to reach public SaaS APIs.