An enterprise web application running on Amazon EC2 instances needs to authenticate with an Amazon RDS for PostgreSQL database. The database password must be rotated every 30 days to comply with security requirements. The developer wants to implement a secure solution that automates the rotation process with the least operational overhead. Which approach should the developer take to meet these requirements?
- Store the database password in AWS Secrets Manager. Enable automatic rotation, choose the target RDS database, and configure a rotation interval of 30 days. Retrieve the secret dynamically in the application using the AWS SDK.Answer
- BStore the database password as a SecureString parameter in AWS Systems Manager Parameter Store. Enable built-in automatic rotation in the Parameter Store settings for RDS and configure a rotation interval of 30 days.
- CStore the database credentials in a secure configuration file packaged with the application. Initialize the AWS SDK client inside the application by hardcoding temporary IAM user access keys that have permission to read the configuration file.
- DStore the database password as a standard String parameter in AWS Systems Manager Parameter Store. Use a local cron job on the EC2 instances to retrieve the parameter using hardcoded AWS access keys and rotate the password in the database.
Answer
Store the database password in AWS Secrets Manager. Enable automatic rotation, choose the target RDS database, and configure a rotation interval of 30 days. Retrieve the secret dynamically in the application using the AWS SDK.
AWS Secrets Manager natively supports automatic rotation of database credentials, including built-in templates for Amazon RDS databases. By enabling rotation and selecting the target RDS database, Secrets Manager automatically updates the database password and the secret value at the specified interval using a managed Lambda function. The application can query Secrets Manager via the AWS SDK at runtime using IAM roles, ensuring it always uses the current credentials without requiring code changes or redeployments.
Step-by-Step Solution
Key Concept
AWS Secrets Manager native RDS rotation vs Systems Manager Parameter Store configuration
Estimated Time:1m 30s