Skip to main content

Deploy a container with a DBC-built image on AWS Fargate

An example that builds a Docker image in DBC and deploys a container to AWS Fargate.

This example lives in the pulumi/examples repository. Check out just this directory to use it:

Get started with this example
git clone --filter=blob:none --sparse https://github.com/pulumi/examples pulumi-examples
git -C pulumi-examples sparse-checkout set aws-ts-containers-dockerbuildcloud
cd pulumi-examples/aws-ts-containers-dockerbuildcloud

Deploys an AWS Fargate service. The service uses a Docker image that is built with Docker Build Cloud (DBC). The image is pushed to AWS ECR. This template prompts the user for an existing DBC builder.

Last revision: May 2024.

This Pulumi example is also written as a template. If you prefer, you can copy it with pulumi new instead of cloning the repo:

Terminal window
pulumi new https://github.com/pulumi/examples/tree/master/aws-ts-containers-dockerbuildcloud

Prerequisites#

  1. Install Pulumi
  2. Configure AWS credentials
  3. Install Node.js
  4. A Docker Build Cloud (DBC) builder — you must complete the DBC builder setup steps
  5. Docker Desktop / CLI
  6. Recommended: a Pulumi Cloud account

Deploying the example#

  1. Create a new stack:

    Terminal window
    pulumi stack init dev
  2. Set the AWS region to deploy into:

    Terminal window
    pulumi config set aws:region us-west-2
  3. Set your existing Docker Build Cloud builder (e.g., cloud-pulumi-my-cool-builder):

    Terminal window
    pulumi config set builder <your-dbc-builder>
  4. Install dependencies:

    Terminal window
    npm install
  5. Deploy the stack:

    Terminal window
    pulumi up
  6. Confirm the service is up and running:

    Terminal window
    curl $(pulumi stack output url)

Cleaning up#

Once you’re finished experimenting, destroy your stack and remove it to avoid incurring further charges:

Terminal window
pulumi destroy
pulumi stack rm

Related

The infrastructure as code platform for any cloud.