aws codedeploy create-deployment: Trigger CodeDeploy in CI
Kick off a CodeDeploy deployment from a revision in S3 or GitHub.
aws codedeploy create-deployment starts a deployment of an application revision to a deployment group (EC2, on-prem, ECS, or Lambda). In CI it follows uploading the bundle to S3, returning a deployment ID you can poll to completion.
Common flags
--application-name- the CodeDeploy application (required)--deployment-group-name- target deployment group (required)--revision- location of the revision (S3 or GitHub spec)--s3-location bucket=...,key=...,bundleType=zip- shorthand S3 revision--description- label the deployment
Example in CI
Deploy a bundle uploaded to S3.
shell
aws codedeploy create-deployment --application-name my-app --deployment-group-name prod --s3-location bucket=${BUCKET},key=app.zip,bundleType=zipCommon errors in CI
- An error occurred (ApplicationDoesNotExistException) - application name wrong
- An error occurred (DeploymentGroupDoesNotExistException) - deployment group typo
- An error occurred (RevisionDoesNotExistException) - S3 key/bucket wrong or not uploaded
- An error occurred (AccessDeniedException) - role lacks codedeploy:CreateDeployment
Key takeaways
- Upload the bundle to S3 first, then reference it with --s3-location.
- The command returns a deployment ID - poll get-deployment for status.
- Most failures are a wrong application, group, or S3 revision path.
Related guides
aws s3 cp: Copy Files to S3 in CIaws s3 cp copies files and directories to and from S3. Learn the recursive, exclude, and ACL flags plus a CI…
aws elasticbeanstalk update-environment: Deploy EB in CIaws elasticbeanstalk update-environment deploys a new application version to an Elastic Beanstalk environment…
aws ecs update-service: Deploy to ECS in CIaws ecs update-service triggers a new ECS deployment with an updated task definition. Learn the force-new-dep…