A company is deploying a serverless microservice on AWS Lambda that requires access to a third-party payment gateway's API key. Security policies mandate that the API key must be encrypted at rest and rotated every 30 days. The rotation process must be automated, and the Lambda function should retrieve the latest key at runtime without requiring manual updates or redeployments. Which solution should a Solutions Architect implement to meet these requirements with the least administrative effort?
- AStore the API key in AWS Systems Manager Parameter Store as a standard String parameter. Configure an Amazon EventBridge rule to trigger a Lambda function every 30 days to update the parameter value.
- Store the API key in AWS Secrets Manager. Configure automatic rotation using a custom AWS Lambda rotation function, and configure the application to retrieve the key dynamically at runtime using the AWS SDK.Answer
- CStore the API key in AWS Systems Manager Parameter Store as a SecureString parameter. Enable automatic rotation on the associated customer managed key in AWS KMS to rotate the API key value every 30 days.
- DStore the API key as a SecureString parameter in AWS Systems Manager Parameter Store. Write a custom script that re-encrypts the existing parameter value with a new AWS KMS key version every 30 days to update the credential.
Answer
Store the API key in AWS Secrets Manager, configure automatic rotation using a custom AWS Lambda rotation function, and retrieve the key dynamically at runtime using the AWS SDK.
AWS Secrets Manager securely stores the API key encrypted at rest and supports built-in integration with AWS Lambda to orchestrate custom rotation workflows. By fetching the secret dynamically using the AWS SDK, the client application always receives the active credential version without requiring redeployment.
Step-by-Step Solution
Key Concept
AWS Secrets Manager supports native, automated rotation of secrets via custom AWS Lambda functions, enabling secure retrieval of credentials at runtime without application redeployment.