More rough notes from my app (mis)adventures. These notes are for Linux, because... life is short, and even if you're on windows you have WSL. Use it.
Process 2, the automated process as part of CI, will follow shortly. I'll update the link here when it's up.
There are better articles kicking about on those than I can write but feel free to browse through my tags. I write summaries that are quite annoying in their brevity, be warned.
The core concepts for ECS (Elastic Container Service) are basically:
In AWS, navigate to ECS > ECR (Elastic Container Registry)
Create a new container repository and give it a name. The important thing here is the repository URI that AWS yields at the end. Take a note of it.
I found the term "repository" very misleading, because it suggests a holding space for a variety of different images. But it's actually going to represent a specific docker image name. Remember that when naming your repos. I.e. it's best to think of a repository as a home for all the evolutions of a particular container image. It muffed me up during the push steps.
Under Images for your new registry, you'll have nothing. But click the View Push Commands button: this gives you the docker and aws-cli commands for pushing your images. In my case, I'll be needing these things to happen inside my git workflow instead (i.e. automated), but one can only really automate that which one can do manually.
Ability to push your image(s) requires that you:
aws ecr get-login-password --region <region> | docker login --username AWS --password-stdin <ecr uri>
Push your image(s)! Essentially:
docker tag localImageName:latest <your ECR uri>/<repositoryName>:latest docker push <your ECR uri>/<repositoryName>:latest
Now use those push commands AWS gave you, to push your images to your spiffy new container registry:
Once your images are pushed, got to ECS > Clusters:
A basic config:
For Networking: main things are to:
Once the cluster is active, goto ECS > Task Definitions and create a new one. I selected an EC2 launch type, not Fargate, which sounds fancy and pricey. Then:
<your ECS container repository uri>/image:tag. Told you that URI would come in handy.
Now go back to ECS > Clusters
You might want to do some research on "scan on push",
ECS_IMAGE_PULL_BEHAVIOR and other env keys that were entirely skipped, never mind glossed over.
If you're doing all this inside an EC2 instance, you'll have to add
ec2_user (which should be familiar if you've tried out EC2 instances) to docker with the command
sudo usermod -a -G docker ec2-user. I didn't follow this path, so can't say more about it.
Found this on EC2 vs Fargate launch types, if you're interested.