A developer is designing a containerized microservice to be deployed on Amazon Elastic Container Service (Amazon ECS) with the AWS Fargate launch type. The microservice requires secure access to two configurations:
1. A database connection string that is static and changes infrequently.
2. A payment gateway API key that must be automatically rotated every 30 days.
The microservice must retrieve the rotated API key dynamically at runtime without requiring a task restart or redeployment. The developer wants to minimize costs and API call latency.
Which combination of configuration steps should the developer implement to meet these requirements? (Select TWO.)
- Store the database connection string as a SecureString parameter in AWS Systems Manager Parameter Store, and reference it in the ECS container definition secrets section using the ECS task execution role for decryption.Cevap
- Store the payment gateway API key in AWS Secrets Manager, configure automatic rotation using an AWS Lambda function, and retrieve the secret dynamically at runtime using the AWS SDK with permissions granted via the ECS task role.Cevap
- CStore the database connection string in AWS Secrets Manager, and reference it in the ECS container definition secrets section with permissions granted to the ECS task role.
- DStore the payment gateway API key in AWS Secrets Manager, configure automatic rotation using an AWS Lambda function, and inject it as an environment variable via the ECS container definition secrets section.
- EStore the payment gateway API key as a SecureString parameter in AWS Systems Manager Parameter Store, and retrieve it dynamically at runtime using the AWS SDK with credentials hardcoded in the microservice's configuration file.
Cevap
Store the database connection string as a SecureString parameter in AWS Systems Manager Parameter Store, referencing it in the ECS container definition secrets section using the ECS task execution role, and store the payment gateway API key in AWS Secrets Manager, configuring automatic rotation using an AWS Lambda function, and retrieving it dynamically at runtime using the AWS SDK with permissions granted via the ECS task role.
For static values like a database connection string, Systems Manager Parameter Store is the most cost-effective solution. Using the ECS container definition's secrets section allows the ECS agent to inject the decrypted parameter as an environment variable at startup, using the Task Execution Role. For values requiring rotation, AWS Secrets Manager is the correct service due to its native support for Lambda-based rotation. To ensure the application dynamically retrieves the rotated key without a task restart, the microservice must query Secrets Manager at runtime using the AWS SDK, leveraging permissions from the ECS Task Role.
Adım Adım Çözüm
Anahtar Kavram
Selecting and integrating Secrets Manager vs Parameter Store based on rotation requirements and ECS role configuration.