- Newest
- Most votes
- Most comments
The issue you're experiencing is not a bug, but rather an expected behavior in AWS CloudFormation and AWS SAM (Serverless Application Model) deployments. When updating Lambda functions, especially when changing attributes like the CPU architecture, CloudFormation optimizes deployments to prevent unnecessary updates and potential disruptions.
In your case, changing the CPU architecture (from x86_64 to arm64 or vice versa) is a significant modification that requires special handling. Here are a few points to consider:
-
When you're changing the CPU architecture, you need to ensure that your function code, dependencies, and any layers or extensions are compatible with the new architecture. This includes creating a new container image that is built for the target architecture.
-
CloudFormation may not automatically detect the change in CPU architecture if only the template is modified. You might need to force an update of the Lambda function.
-
To ensure the change takes effect, you can try the following:
- Use a different name for your new ARM-based container image in ECR.
- Update the CodeUri or ImageUri in your SAM template to point to the new image.
- If using parameters in your template, update a version or timestamp parameter to force a new deployment.
-
In some cases, you may need to delete the existing Lambda function and recreate it with the new architecture, especially if other update methods don't work.
-
Verify that your pipeline is correctly building and pushing the ARM-based image to ECR before deploying the updated SAM template.
-
After deployment, double-check both the CloudFormation stack and the Lambda console to ensure the changes have been applied correctly.
Remember, when migrating between architectures, it's crucial to thoroughly test your function to ensure it performs as expected on the new architecture. If issues persist, you may need to review your deployment pipeline and SAM template to ensure all necessary changes are being made and propagated correctly.
Sources
Lambda Layer not changing when taken from S3 in cf template | AWS re:Post
Selecting and configuring an instruction set architecture for your Lambda function - AWS Lambda
AWS Lambda FUnction | AWS re:Post
Relevant content
- asked 2 years ago
- asked 4 years ago
