Next, to deploy the application and its infrastructure, follow these steps:
Create a new stack, which is an isolated deployment target for this example:
$ pulumi stack init dev
Set your desired AWS region:
$ pulumi config set aws:region us-east-1 # any valid AWS region will work
Deploy everything with a single pulumi up command. This will show you a preview of changes first, which
includes all of the required AWS resources (clusters, services, and the like). Don't worry if it's more than
you expected -- this is one of the benefits of Pulumi, it configures everything so that so you don't need to!
$ pulumi up
After being prompted and selecting "yes", your deployment will begin. It'll complete in a few minutes:
Updating (dev):
Type Name Status
+ pulumi:pulumi:Stack aws-go-fargate-dev created
+ ├─ aws:ec2:SecurityGroup web-sg created
+ ├─ aws:ecs:Cluster app-cluster created
+ ├─ aws:iam:Role task-exec-role created
+ ├─ aws:elasticloadbalancingv2:TargetGroup web-tg created
+ ├─ aws:ecr:Repository app-repo created
+ ├─ docker:image:Image app-img created
+ ├─ aws:iam:RolePolicyAttachment task-exec-policy created
+ ├─ aws:ecs:TaskDefinition app-task created
+ ├─ aws:elasticloadbalancingv2:LoadBalancer web-lb created
+ └─ aws:ecs:Service app-svc created
Outputs:
url: "web-lb-651d804-400248986.us-west-2.elb.amazonaws.com"
Resources:
+ 11 created
Duration: 3m41s
Permalink: https://app.pulumi.com/acmecorp/aws-go-fargate/dev/updates/1
Notice that the automatically assigned load-balancer URL is printed as a stack output.
At this point, your app is running -- let's curl it. The CLI makes it easy to grab the URL: