Docker Platform AWS EB

If your application consists of only one container, all you need is a Dockerfile in the repository: Elastic Beanstalk will use it to build the image and run the container with application.

This article will show you how to automate the process of building and deploying single-container images with Buddy. The multi-container version of the article is available here.

Set a Docker application in Elastic Beanstalk

  1. Log in to your AWS account
  2. Go to the Elastic Beanstalk service
  3. Add the application:

    • Select Web server as the Tier
    • Select Docker as the Platform

Copy the Access key and the Secret key

To automate the deployment you need a user with the permission AWSElasticBeanstalkFullAccess so you can copy their Access and Secret keys. To create such user do the following:

  1. Log in to your AWS account
  2. Go to Users and click Add user
  3. Set the access type to Programmatic Access

  4. Look up and addAWSElasticBeanstalkFullAccess permission
  5. Once the user is added, download the CSV with its access details

Configure a pipeline in Buddy

Now you can create a pipeline that automatically build a Docker image on push to the repository, push it to the Docker Hub and deploy to Elastic Beanstalk. In this example we'll use this repository, a static HTML site displayed with NGINX.

  1. Add a new project in Buddy and select GitHub as the provider.
  2. Choose the repository from the list:

  3. Add a new pipeline and set the trigger mode to On every push:
  4. Add the Docker build action that will build and push your image to the registry:

  5. Add the Upload to ElasticBeanstalk action:

    • Copy and paste the Access and Secret keys from your AWS account
    • Select your AWS region and Application
    • Select Repository as the deployment source

When you're ready, make a push and watch Buddy build and deploy your Docker image: if you open your application in Elastic Beanstalk you'll see it's being updated. Once the update is over, open the app to see the "Hello World" page.

Notes:

  • You can add an action that will build and test your application before deploying it to Elastic Beanstalk as a Docker image. In this case select the Filesystem as the source in the deployment action.
  • If you have more than one Dockerfile in the app, you can add a build action for every image.

Last modified on April 26, 2022

Get Started

Sign up for free and deploy your project in less than 10 minutes.