A financial services company runs a high-throughput transaction processing application on a fleet of Amazon EC2 instances within an Auto Scaling group. The application reads its feature flags and runtime configurations from a local file on each instance. The operations team needs to automate the management and deployment of these configuration updates. The solution must support validating the configuration syntax before deployment, gradually rolling out the configuration updates to the instances over a period of minutes, and automatically rolling back the deployment if application error rates spike during the rollout. Additionally, the configuration update must be applied with zero downtime and without terminating or launching any EC2 instances. Which approach should a solutions architect recommend to meet these requirements with the least operational overhead?
- AStore the configurations in AWS Systems Manager Parameter Store. Create an AWS Systems Manager State Manager association to run a custom Systems Manager Document every minutes that pulls the parameter values and overwrites the local configuration file on all instances. Deploy an AWS Lambda function triggered by CloudWatch alarms to restore the previous parameter version in Parameter Store if error rates spike.
- BUse AWS CloudFormation StackSets to manage the configuration files. Store the configuration files in an Amazon S3 bucket, update the Auto Scaling group launch template with the new S3 file path in the UserData, and perform an Instance Refresh to roll out the updates. Configure StackSets automatic rollback on CloudWatch alarms.
- Use AWS AppConfig. Store the configurations in an AppConfig hosted configuration store and configure a JSON schema validator. Deploy the configuration using a custom deployment strategy that defines a -minute rollout duration and associates a CloudWatch alarm for application error rates as the bake time monitor. Run the AWS AppConfig Agent on the EC2 instances to retrieve and apply the configuration updates.Answer
- DUse AWS Config rules to monitor the local configuration files. When a change is detected, trigger an AWS Systems Manager Automation runbook using an AWS-managed KMS key (aws/ssm) to run a script that updates the files. Modify the key policy of the aws/ssm key to allow the cross-account validation Lambda function to decrypt the configuration payload.