$ copilot deploy
What does it do?
This command is used to get you from local manifests to deployed service and environment. It will check for deployed infrastructure and local manifests, help you initialize and deploy an environment, and deploy a workload.
If a workload is uninitialized,
--init-wkld will initialize the workload before deploying it.
If the desired environment is uninitialized, you may initialize it with
--deploy-env flag can be specified to skip environment deployment confirmation, or can be set to false (
--deploy-env=false) to skip
deploying the environment.
The steps involved in
copilot deploy are as follows:
- If your service does not exist, optionally initialize it.
- If the target environment does not exist, optionally initialize it with custom credentials.
- Optionally deploy the environment before service deployment.
image.buildexists in the manifest:
- Build your local Dockerfile into an image
- Tag it with the value from
--tagor the latest git sha (if you're in a git directory)
- Push the image to ECR
- Package your manifest file and addons into CloudFormation.
- Create / update your ECS task definition and job or service.
What are the flags?
--allow-downgrade Optional. Allow using an older version of Copilot to update Copilot components updated by a newer version of Copilot. -a, --app string Name of the application. --aws-access-key-id string Optional. An AWS access key for the environment account. --aws-secret-access-key string Optional. An AWS secret access key for the environment account. --aws-session-token string Optional. An AWS session token for temporary credentials. --deploy-env bool Deploy the target environment before deploying the workload. --detach bool Optional. Skip displaying CloudFormation deployment progress. -e, --env string Name of the environment. --force Optional. Force a new service deployment using the existing image. Not available with the "Static Site" service type. -h, --help help for deploy --init-env bool Confirm initializing the target environment if it does not exist. --init-wkld bool Optional. Initialize a workload before deploying it. -n, --name string Name of the service or job. --no-rollback bool Optional. Disable automatic stack rollback in case of deployment failure. We do not recommend using this flag for a production environment. --profile string Name of the profile for the environment account. --region string Optional. An AWS region where the environment will be created. --resource-tags stringToString Optional. Labels with a key and value separated by commas. Allows you to categorize resources. (default ) --tag string Optional. The tag for the container images Copilot builds from Dockerfiles.
--no-rollback flag is not recommended while deploying to a production environment as it may introduce service downtime.
If the deployment fails when automatic stack rollback is disabled, you may be required to manually start the stack
rollback of the stack via the AWS console or AWS CLI before the next deployment.
Deploys a service named "frontend" to a "test" environment.
$ copilot deploy --name frontend --env test
Deploys a job named "mailer" with additional resource tags to a "prod" environment.
$ copilot deploy -n mailer -e prod --resource-tags source/revision=bb133e7,deployment/initiator=manual
Initializes and deploys an environment named "test" in us-west-2 under the "default" profile with local manifest, then deploys a service named "api"
$ copilot deploy --init-env --deploy-env --env test --name api --profile default --region us-west-2
Initializes and deploys a service named "backend" to a "prod" environment.
$ copilot deploy --init-wkld --deploy-env=false --env prod --name backend