What step is required to update the function with the changes?
Delete the .ZIP file on S3, and re-upload by using a different object key name.
Update the CloudFormation stack with the correct values for the function code properties S3Bucket, S3Key, or S3ObjectVersion.
Ensure that the function source code is base64-encoded before uploading the deployment package to S3.
Modify the execution role of the Lambda function to allow S3 access permission to the deployment package .ZIP file.
Explanations:
Deleting and re-uploading the .ZIP file with a different key name is unnecessary. CloudFormation tracks the S3 object by its key, and it will still refer to the same object in the bucket as long as the key and version are correct.
Updating the CloudFormation stack with the correct values for the function code properties (S3Bucket,S3Key, orS3ObjectVersion) ensures that CloudFormation redeploys the Lambda function using the new code from the S3 bucket.
The Lambda function code doesn’t need to be base64-encoded for deployment via S3. The .ZIP file can be uploaded directly without encoding.
The Lambda execution role does not require permissions to access the deployment package in S3. The permissions to access the S3 bucket for Lambda code deployment are managed by the CloudFormation template and IAM roles associated with the deployment, not the execution role.