Creating a Copilot App
These are the steps I followed to create a new copilot app.
copilot app initthe app is a group of jobs and services
- on
init, it creates a StackSet role in cloud formation that will hold all the jobs and services; and an IAM role for all the permissions
- on
copilot initthis prompts you to create your first job/svc
follow dialogues to create job (not documented here)
copilot env initjust create a prod environment with defaults
this is a space that holds things later, e.g. credentials
creates tons of connections to Cloud Formation, VPCs etc. Not sure what really happens
copilot env deploypushes everything live
again unsure what happens but is just required subsequent to
env init
copilot secret initwe need secrets to provide the equivalent of the .env file used locally
create one per, then add an entry to the job’s manifest YAML file like so:
PROD_PASSWORD: /copilot/${COPILOT_APPLICATION_NAME}/${COPILOT_ENVIRONMENT_NAME}/secrets/PROD_PASSWORD PROD_URL: /copilot/${COPILOT_APPLICATION_NAME}/${COPILOT_ENVIRONMENT_NAME}/secrets/PROD_URL S3_ACCESS: /copilot/${COPILOT_APPLICATION_NAME}/${COPILOT_ENVIRONMENT_NAME}/secrets/S3_ACCESS S3_SECRET: /copilot/${COPILOT_APPLICATION_NAME}/${COPILOT_ENVIRONMENT_NAME}/secrets/S3_SECRET
now that the job definition exists, and the secrets to which that definition refers are created, you can
- deploy the job with
copilot job deploy you should see it building the docker image with from the file you specified
it then pushes this image to the ECR
- then, there are a handful of other tasks run at once
IAM roles
CloudWatch log group
ECS task definition
- to test any job, you can call
copilot job run you should see a running task in the ECS menu
you should see new logs in the corresponding CloudWatch log group
- to test any job, you can call
copilot pipeline initthis creates the manifest and buildspec for a new pipeline, which is an automatic
sourcing and deployment process
copilot pipeline deploythis launches the defined pipeline
it will ask you to authenticate a connection to your github repo; click around a bunch
and enter your passwords etc