Experimenting With Containers On AWS ECR And ECS

Posted on March 09, 2019

The BackStory

I’ve been working with containers via docker-compose and Dockerfiles for about a year and a half now. But, we’ve never really had an opportunity to push it into production.

It has largely just been a tool to have consistent dev enviroments. And it closely mimics our production enviroment.

Over the last month or so, I’ve been deploying more and more serverless Lambda’s in both Go and Nodejs. It’s been awesome. It is so freeing to not have to worry about servers.

Meanwhile, our production apps are largely running on Elastic Beanstalk. It’s a fairly good platform and we’ve had very few issues with it.

However, I’ve seen ECS get increasingly more popular over the last few years. And wanted to experiment with it.

I also have some needs coming up for some Go servers that may be better served not on a Lambda.

ECS interested me because of AWS Fargate. Essentially, you can scale up containers of code without servers.

Currently with Beanstalk, you very much are still managing, seeing, selecting, and engaging with EC2 servers. It’s not the biggest pain. But, you definely notice it when you come back from Lambda-land.


Deploying Go With Docker

I went with Go Dep and build a Makefile for packaging up my Go app.

I then logged into AWS Elastic Container Registry via terminal.

Then, I tagged and pushed my Docker images to ECR.

It was a fairly seemless experience configuring a cluster via the AWS Elastic Container Serverice interface from there.

I have a few things that I would like to make better. But, it was a good proof of concept.

Next Steps

There are several concerns still outstanding. Enviroment variables not being passed in via your docker build command, auto-refreshing the docker image on save in dev mode, and setting up a CI/CD pipeline for this process are probably my BIG THREE next things.

But, I’m pretty happy with the result for a quick Saturday morning project.


Here are some links that helped me:

  1. Docker & ECS In Production
  2. Official Go Docker Docs
  3. Golang and Docker for development and production
  4. Dockerizing Go
  5. Pushing Docker Images To ECR