skip to Main Content

After new code is pushed to lambda, I am running the following comands

Create new version from the $LATEST code

ver=$(aws lambda publish-version --function-name my-function --description "New version" --output text --query 'Version')

Point lambda alias to new version

aws lambda update-alias --function-name my-function --name dev --function-version $ver

Then if I check the Alias in AWS console, it still shows it is pointing to old version.
The screen shot below shows Alias is still pointing to old version.

enter image description here

If I wait for few mins and refresh the console then I see alias is pointing to new version.
enter image description here

Does it take time for Alias to point to new version? or is it just a console that is not getting updated configuration immediately.

3

Answers


  1. It looks like you have canary deployment enabled. The canary configuration is creating the delay you’re seeing. If you want to propagate your changes instantly, I’d recommend disabling the canary deployment.

    Canary Deployments with Alias Traffic Shifting

    Login or Signup to reply.
  2. This seem to be common issues.

    Just curious, do you have provisioned concurrency & autoscaling turned on?

    You can try change the description to something different on every publish-version (but I doubt the change would be immediate with provisioned concurrency turned on)

    Login or Signup to reply.
  3. This works for me

    API Version

    aws-cli/1.25.83 Python/3.8.10 Linux/5.8.0-63-generic botocore/1.29.125
    

    Steps:

    • Publish new version (returns latest version if no code changes)
    ver=$(aws lambda publish-version --function-name my-function --description "New version" --output text --query 'Version' )
    
    • Update Alias with new version, additionally here we’re clearing weighted config using --routing -config AdditionalVersionWeights={} (if any)
    aws lambda update-alias --function-name my-function --name dev --function-version $ver --routing-config AdditionalVersionWeights={}
    

    When I Check the Alias Config through cli as well as Console, I got the expected output immediately

    aws lambda get-alias --function-name my-function --name dev 
    

    Before:
    Lambda Alias Details Before

    After:
    Lambda Alias Details After

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search