dockeraws-lambdaazure-devopsaws-lambda-containers

Is there an Azure DevOps task to automatically deploy a new AWS Lambda *docker image*?


I have an AWS Lambda function that runs a Docker image I create in Azure Devops.

My Azure DevOps Pipeline contains a Docker build task, and then an ECRPushImage task to push that image to AWS.

Currently, after pushing a new image, I have to go to the Lambda function's page and click on "Deploy new image" so the function updates and switches to the newly pushed image.

Can I automatize this step in AWS DevOps? I know of the LambdaDeployFunction task in the AWS Toolkit for Azure DevOps, but it seems that this task's configuration can only handle deploying zip files, either stored locally or on S3 (see here).

If that is not possible, what would be the best way to do that last step (i.e. deploying the new docker image to Lambda) from within AWS?


Solution

  • You can do it using AWS CLI by running the following command.

    aws lambda update-function-code \
        --function-name  my-function \
        --image-uri ecr-image-uri
    

    In Azure DevOps, you can use AWS CLI task to run the above command.

    enter image description here