Deploys an AWS Fargate service.
- Method one is the OG. It wraps the original Pulumi IaC code that uses dockerBuild and runs it in Dagger.
- Method two, breaks up the original IaC into a separate
ecr
stack and afargate
stack. Dagger will do a build of Nginx running the Dagger docs site (using Docusaurus) and push the image to ECR. Dagger orchestrates the running of the whole thing including bringing up Pulumi, etc. You don't need to have Pulumi installed already! You just need Dagger installed and a way to run containers (such as Docker Desktop, Rancher Desktop, Lima/Colima/Nerdctl, Podman, etc). ESC is used to store values likeecrRepo
andimageURL
to allow both Pulumi and Dagger functions (all orchestrated by Dagger) to work together.
Last revision: August 2024.
- Dagger CLI: https://docs.dagger.io/install
- Pulumi Token called
PULUMI_TOKEN
available in your environment (local or CI) Pulumi CLINot needed, Dagger Pulumi module will provideRecommendedRequired since we're using ESC Pulumi Cloud account Create an ESC environment calledaws-ecs-demo
and setup AWS OIDC integration (see below) as well as put the following undervalues: pulumiConfig:
in your ESC Environment definition:
ecrTag: latest
awsRegion: us-east-2
awsAcctId: '<your account id number>'
npmNot needed, Dagger will provideAWS account and credentials configuredUse Pulumi ESC's AWS OIDC integration- Docker desktop (or similar)
with a default builder.(build handled by Dagger)
To deploy your infrastructure, run:
$ dagger call deploy --source=. --token=env:PULUMI_TOKEN
# wait a bit for everything to get deployed
# ...
# confirm your service is up and running
# by navigating to load balancer URL emitted :)
# 🎉 Ta-Da!
To clean up your infrastructure, run:
For the more complex deploy()
function
$ dagger call destroy --source=. --token=env:PULUMI_TOKEN
For the all-in-one og()
function:
$ dagger call destroy-og --source=. --token=env:PULUMI_TOKEN