Deploy a container with a Docker Build image on AWS Fargate
An example that builds a Docker image and deploys a container to AWS Fargate.
This example lives in the pulumi/examples repository. Check out just this directory to use it:
git clone --filter=blob:none --sparse https://github.com/pulumi/examples pulumi-examplesgit -C pulumi-examples sparse-checkout set aws-ts-containers-dockerbuildcd pulumi-examples/aws-ts-containers-dockerbuildDeploys an AWS Fargate service. The service uses a Docker image that is built with the Docker Build provider. The image is pushed to AWS ECR.
Last revision: July 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:
pulumi new https://github.com/pulumi/examples/tree/master/aws-ts-containers-dockerbuildPrerequisites#
- Install Pulumi
- Configure AWS credentials
- Install Node.js
- Install Docker with a default builder
- Recommended: a Pulumi Cloud account
Deploying the example#
-
Create a new stack:
Terminal window pulumi stack init dev -
Set the AWS region to deploy into:
Terminal window pulumi config set aws:region us-west-2 -
Install dependencies:
Terminal window npm install -
Deploy the stack:
Terminal window pulumi up -
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:
pulumi destroypulumi stack rm