A financial services company is migrating its backend payment processing microservice to a serverless architecture using Amazon API Gateway and AWS Lambda. Due to strict compliance and risk mitigation guidelines, any deployment of a new code version must be exposed to production traffic gradually. Specifically, the new version must receive 10% of traffic initially, and then the remaining traffic must be routed in equal increments of 10% every 10 minutes. If the payment processing latency exceeds 500 ms or if the Lambda error rate exceeds 1% at any point during the deployment, the deployment must automatically and immediately roll back. Additionally, the Lambda function relies on a database connection pool that must be fully initialized and pre-warmed before the new version starts serving any production traffic to prevent connection timeout errors during the initial traffic shift. Which deployment strategy should the solutions architect implement to meet these requirements with the least operational complexity?
- Deploy the Lambda function using AWS CloudFormation and configure the AWS::Lambda::Alias resource with a DeploymentPreference type set to CodeDeployDefault.LambdaLinear10PercentEvery10Minutes. Associate the deployment with CloudWatch Alarms for function errors and latency. Define a BeforeAllowTraffic lifecycle hook in the AppSpec file to execute a validation Lambda function that pre-warms the database connection pool.Cevap
- BDeploy the Lambda function using AWS CloudFormation and configure the AWS::Lambda::Alias resource with a DeploymentPreference type set to CodeDeployDefault.LambdaCanary10Percent10Minutes. Associate the deployment with CloudWatch Alarms for function errors and latency. Define a BeforeAllowTraffic lifecycle hook in the AppSpec file to execute a validation Lambda function that pre-warms the database connection pool.
- CDeploy the Lambda function using AWS CloudFormation and configure the AWS::Lambda::Alias resource with a DeploymentPreference type set to CodeDeployDefault.LambdaLinear10PercentEvery10Minutes. Associate the deployment with CloudWatch Alarms for function errors and latency. Define an AfterAllowTraffic lifecycle hook in the AppSpec file to execute a validation Lambda function that pre-warms the database connection pool.
- DDeploy the new Lambda function version and configure an API Gateway canary release with a 10% traffic weighting. Create an AWS Step Functions state machine that invokes a Lambda function to update the API Gateway deployment stage weights by 10% every 10 minutes. Use a second Lambda function to monitor the CloudWatch metrics and programmatically delete the canary configuration if thresholds are exceeded.