aws-toolkit-azure-devops
aws-toolkit-azure-devops copied to clipboard
CodeDeploy Task does not work with Lambda or ECS deployment
Attempting to use the CodeDeploy task type results in the following error:
Depending on selected parameters the task may also require permissions to verify your deployment bundle exists in S3 or upload your application bundle to the specified Amazon S3 bucket. Depending on the size of the application bundle, either PutObject or the S3 multi-part upload APIs may be used.
2019-08-17T16:41:15.6465824Z ==============================================================================
2019-08-17T16:41:16.2934161Z Configuring credentials for task
2019-08-17T16:41:16.2937690Z dd302d74-04b2-4282-9141-d236b04a4a44 exists true
2019-08-17T16:41:16.2938083Z ...configuring AWS credentials from service endpoint 'dd302d74-04b2-4282-9141-d236b04a4a44'
2019-08-17T16:41:16.2938316Z ...endpoint defines standard access/secret key credentials
2019-08-17T16:41:16.2956669Z Configuring region for task
2019-08-17T16:41:16.2958387Z ...configured to use region us-east-1, defined in task.
2019-08-17T16:41:17.2782616Z Request to deploy new revision returned error: For Lambda and ECS deployment, fileExistsBehavior can not be specified { InvalidFileExistsBehaviorException: For Lambda and ECS deployment, fileExistsBehavior can not be specified
2019-08-17T16:41:17.2782844Z Configuring credentials for task
2019-08-17T16:41:17.2788160Z at constructor.extractError (D:\a_tasks\CodeDeployDeployApplication_2ff35748-7800-409d-9511-a0a37ff0d348\1.4.0\CodeDeployDeployApplication.js:5:4968)
2019-08-17T16:41:17.2789647Z at constructor.callListeners (D:\a_tasks\CodeDeployDeployApplication_2ff35748-7800-409d-9511-a0a37ff0d348\1.4.0\CodeDeployDeployApplication.js:5:64577)
2019-08-17T16:41:17.2789781Z at constructor.emit (D:\a_tasks\CodeDeployDeployApplication_2ff35748-7800-409d-9511-a0a37ff0d348\1.4.0\CodeDeployDeployApplication.js:5:64287)
2019-08-17T16:41:17.2789862Z at constructor.emitEvent (D:\a_tasks\CodeDeployDeployApplication_2ff35748-7800-409d-9511-a0a37ff0d348\1.4.0\CodeDeployDeployApplication.js:17:42573)
2019-08-17T16:41:17.2790361Z at constructor.e (D:\a_tasks\CodeDeployDeployApplication_2ff35748-7800-409d-9511-a0a37ff0d348\1.4.0\CodeDeployDeployApplication.js:17:38146)
2019-08-17T16:41:17.2790513Z at r.runTo (D:\a_tasks\CodeDeployDeployApplication_2ff35748-7800-409d-9511-a0a37ff0d348\1.4.0\CodeDeployDeployApplication.js:17:44409)
2019-08-17T16:41:17.2790631Z at D:\a_tasks\CodeDeployDeployApplication_2ff35748-7800-409d-9511-a0a37ff0d348\1.4.0\CodeDeployDeployApplication.js:17:44614
2019-08-17T16:41:17.2790733Z at constructor.
To reproduce Attempting to use the Code Deployment module by referencing either a "Archive file in Amazon S3" or a "Folder or archive file in the workspace" results in the same error.
Use an "AWS Lambda" compute type for the CodeDeploy application.
The role executing this task has been granted the following code deployment rights: "codedeploy:GetDeploymentGroup", "codedeploy:CreateDeployment", "codedeploy:RegisterApplicationRevision", "codedeploy:GetDeploymentConfig", "codedeploy:GetDeployment", "codedeploy:StopDeployment", "codedeploy:CreateDeploymentGroup", "codedeploy:ContinueDeployment", "codedeploy:GetApplication"
I also attempted this with by granting the user right all rights available (codedeploy:*) and got the same behavior. I did validate that the referenced application and deployment group exists.
After reviewing the following documentation: https://docs.aws.amazon.com/cli/latest/reference/deploy/create-deployment.html
I suspect that there the CodeDeploy API has changed and the way the CodeDeploy task is integrating with it needs to be updated.
Expected behavior A successful push to CodeDeploy.
Your Environment
- Azure DevOps running Unbuntu deployment agent
- AWS VSTS Tools version: 1.4.0
Additional context I also verified that I am installing the CodeDeploy Agent in a prior step in my release pipeline.
@johniwasz To confirm, it looks like you are doing a deployment to ECS or Lambda? The task was originally written to only work with EC2, so the task requires fields that should not be there for ECS and Lambda. Unfortunately, we do not currently have a workaround.
This is for a Lambda deployment. Thanks for clarifying the intended use of the CodeDeploy task.
I ended up going with an AWS::Serverless::Function driven SAM deployment since I'm already using Cloud Formation templates per the suggestions in this blog:
https://aws.amazon.com/blogs/compute/implementing-canary-deployments-of-aws-lambda-functions-with-alias-traffic-shifting/
I'm reopening this issue so we can track fixing the root problem, which should still be fixed.
casually performs issue necromancy
Has anyone has found a workaround for this issue yet?
I've had a similar issue, I have been trying to deploy an ECS application using CodeDeploy. The only way I managed to get Azure to run the pipeline and create a new deployment is by using the AWS CLI Task and manually calling the deploy command and create-deployment sub-command. The options and parameters will vary depending on your implementation, for me, I had to specify the --application-name, --deployment-group-name and --s3-location.
This is the link to the was cli docs page I used as reference. And here's a quick link to the examples on the same page

Having similar issues with this task here, getting the following error:
Request to deploy new revision returned error: For Lambda, ECS and Kubernetes deployment, fileExistsBehavior can not be specified { InvalidFileExistsBehaviorException: For Lambda, ECS and Kubernetes deployment, fileExistsBehavior can not be specified
We already had it working with the command line, but I was hoping to move it back to a proper task so that the job only completes when the actual deployment completes, but can see that's not an option right now so will reluctantly revert