Container Service on AWS
The AWS Container Service template scaffolds a Pulumi project that deploys a containerized service to AWS. The architecture includes an Amazon ECS cluster for orchestration, AWS Fargate for serverless compute, an Application Load Balancer for internet ingress, and an Amazon Elastic Container Registry (ECR) repository for the container image. The template ships with an Nginx Dockerfile so the project deploys end to end out of the box.
Before you begin#
For this walkthrough, you'll need:
- The Pulumi CLI
- An AWS account with programmatic access
- The AWS CLI (optional, but recommended and used in this guide)
- Permission to manage ECS, ECR, load balancers, and IAM
- Docker installed and running
For this walkthrough, you'll need:
- The Pulumi CLI
- An AWS account with programmatic access
- The AWS CLI (optional, but recommended and used in this guide)
- Permission to manage ECS, ECR, load balancers, and IAM
- Docker installed and running
For this walkthrough, you'll need:
- The Pulumi CLI
- An AWS account with programmatic access
- The AWS CLI (optional, but recommended and used in this guide)
- Permission to manage ECS, ECR, load balancers, and IAM
- A current version of Go installed locally
- Docker installed and running
For this walkthrough, you'll need:
- The Pulumi CLI
- An AWS account with programmatic access
- The AWS CLI (optional, but recommended and used in this guide)
- Permission to manage ECS, ECR, load balancers, and IAM
- A current version of .NET installed locally
- Docker installed and running
For this walkthrough, you'll need:
- The Pulumi CLI
- An AWS account with programmatic access
- The AWS CLI (optional, but recommended and used in this guide)
- Permission to manage ECS, ECR, load balancers, and IAM
- Docker installed and running
For this walkthrough, you'll need:
- A current version of the Pulumi CLI (Pulumi HCL requires no additional runtime)
- An AWS account with programmatic access
- The AWS CLI (optional, but recommended and used in this guide)
- Permission to manage ECS, ECR, load balancers, and IAM
- Docker installed and running
Create a new project#
Create a new project from the template:
mkdir my-container-service; cd my-container-servicepulumi new container-aws-typescriptmkdir my-container-service; cd my-container-servicepulumi new container-aws-typescriptmkdir my-container-service; cd my-container-servicepulumi new container-aws-pythonmkdir my-container-service; cd my-container-servicepulumi new container-aws-pythonmkdir my-container-service; cd my-container-servicepulumi new container-aws-gomkdir my-container-service; cd my-container-servicepulumi new container-aws-gomkdir my-container-service; cd my-container-servicepulumi new container-aws-csharpmkdir my-container-service; cd my-container-servicepulumi new container-aws-csharpmkdir my-container-service; cd my-container-servicepulumi new container-aws-yamlmkdir my-container-service; cd my-container-servicepulumi new container-aws-yamlmkdir my-container-service; cd my-container-servicepulumi new container-aws-hclmkdir my-container-service; cd my-container-servicepulumi new container-aws-hclThe pulumi new command walks you through creating and configuring the new project and stack. A stack is an instance of a project, and you can have many of them (dev, staging, prod), each with its own configuration settings. Depending on the language, you may also be asked for your preferred package manager or toolchain.
This template’s settings include:
| Key | Description | Default |
|---|---|---|
| aws:region | The AWS region to deploy into | us-west-2 |
| containerPort | The port to expose on the container | 80 |
| cpu | The amount of CPU to allocate for the container | 512 |
| memory | The amount of memory to allocate for the container | 128 |
pulumi config set
:
pulumi config set aws:region <value>pulumi config set containerPort <value>pulumi config set cpu <value>pulumi config set memory <value>pulumi config set aws:region "<value>"pulumi config set containerPort "<value>"pulumi config set cpu "<value>"pulumi config set memory "<value>"| Key | Description | Default |
|---|---|---|
| aws:region | The AWS region to deploy into | us-west-2 |
| containerPort | The port to expose on the container | 80 |
| cpu | The amount of CPU to allocate for the container | 512 |
| memory | The amount of memory to allocate for the container | 128 |
pulumi config set
:
pulumi config set aws:region <value>pulumi config set containerPort <value>pulumi config set cpu <value>pulumi config set memory <value>pulumi config set aws:region "<value>"pulumi config set containerPort "<value>"pulumi config set cpu "<value>"pulumi config set memory "<value>"| Key | Description | Default |
|---|---|---|
| aws:region | The AWS region to deploy into | us-west-2 |
| containerPort | The port to expose on the container | 80 |
| cpu | The amount of CPU to allocate for the container | 512 |
| memory | The amount of memory to allocate for the container | 128 |
pulumi config set
:
pulumi config set aws:region <value>pulumi config set containerPort <value>pulumi config set cpu <value>pulumi config set memory <value>pulumi config set aws:region "<value>"pulumi config set containerPort "<value>"pulumi config set cpu "<value>"pulumi config set memory "<value>"| Key | Description | Default |
|---|---|---|
| aws:region | The AWS region to deploy into | us-west-2 |
| containerPort | The port to expose on the container | 80 |
| cpu | The amount of CPU to allocate for the container | 512 |
| memory | The amount of memory to allocate for the container | 128 |
pulumi config set
:
pulumi config set aws:region <value>pulumi config set containerPort <value>pulumi config set cpu <value>pulumi config set memory <value>pulumi config set aws:region "<value>"pulumi config set containerPort "<value>"pulumi config set cpu "<value>"pulumi config set memory "<value>"| Key | Description | Default |
|---|---|---|
| aws:region | The AWS region to deploy into | us-west-2 |
| containerPort | The port to expose on the container | 80 |
| cpu | The amount of CPU to allocate for the container | 512 |
| memory | The amount of memory to allocate for the container | 128 |
pulumi config set
:
pulumi config set aws:region <value>pulumi config set containerPort <value>pulumi config set cpu <value>pulumi config set memory <value>pulumi config set aws:region "<value>"pulumi config set containerPort "<value>"pulumi config set cpu "<value>"pulumi config set memory "<value>"| Key | Description | Default |
|---|---|---|
| aws:region | The AWS region to deploy into | us-west-2 |
| container_port | The port to expose on the container | 80 |
| cpu | The amount of CPU to allocate for the container | 512 |
| memory | The amount of memory to allocate for the container | 128 |
pulumi config set
:
pulumi config set aws:region <value>pulumi config set container_port <value>pulumi config set cpu <value>pulumi config set memory <value>pulumi config set aws:region "<value>"pulumi config set container_port "<value>"pulumi config set cpu "<value>"pulumi config set memory "<value>"Review the code#
When setup completes, you’ll see a few files:
Pulumi.yamlcontains the project name and the language it’s written in.Pulumi.dev.yamlcontains thedevstack’s settings, including the values you just entered.index.tsindex.js__main__.pymain.goProgram.csProgram.fsProgram.vbApp.javaPulumi.yamlmain.tfcontains the program code that declares your cloud resources.
When setup completes, you’ll see a few files:
Pulumi.yamlcontains the project name and the language it’s written in.Pulumi.dev.yamlcontains thedevstack’s settings, including the values you just entered.index.tsindex.js__main__.pymain.goProgram.csProgram.fsProgram.vbApp.javaPulumi.yamlmain.tfcontains the program code that declares your cloud resources.
When setup completes, you’ll see a few files:
Pulumi.yamlcontains the project name and the language it’s written in.Pulumi.dev.yamlcontains thedevstack’s settings, including the values you just entered.index.tsindex.js__main__.pymain.goProgram.csProgram.fsProgram.vbApp.javaPulumi.yamlmain.tfcontains the program code that declares your cloud resources.
When setup completes, you’ll see a few files:
Pulumi.yamlcontains the project name and the language it’s written in.Pulumi.dev.yamlcontains thedevstack’s settings, including the values you just entered.index.tsindex.js__main__.pymain.goProgram.csProgram.fsProgram.vbApp.javaPulumi.yamlmain.tfcontains the program code that declares your cloud resources.
When setup completes, you’ll see a few files:
Pulumi.yamlcontains the project name and the resources it declares.Pulumi.dev.yamlcontains thedevstack’s settings, including the values you just entered.
When setup completes, you’ll see a few files:
Pulumi.yamlcontains the project name and the language it’s written in.Pulumi.dev.yamlcontains thedevstack’s settings, including the values you just entered.index.tsindex.js__main__.pymain.goProgram.csProgram.fsProgram.vbApp.javaPulumi.yamlmain.tfcontains the program code that declares your cloud resources.
Take a moment to open them up and have a look. Here’s what’s in index.tsindex.js__main__.pymain.goProgram.csProgram.fsProgram.vbApp.javaPulumi.yamlmain.tf:
import * as pulumi from "@pulumi/pulumi";import * as aws from "@pulumi/aws";import * as awsx from "@pulumi/awsx";
const config = new pulumi.Config();const containerPort = config.getNumber("containerPort") || 80;const cpu = config.getNumber("cpu") || 512;const memory = config.getNumber("memory") || 128;
// An ECS cluster to deploy intoconst cluster = new aws.ecs.Cluster("cluster", {});
// An ALB to serve the container endpoint to the internetconst loadbalancer = new awsx.lb.ApplicationLoadBalancer("loadbalancer", {});
// An ECR repository to store the application's container imageconst repo = new awsx.ecr.Repository("repo", { forceDelete: true,});
// Build and publish the application's container image from ./app to the ECR repositoryconst image = new awsx.ecr.Image("image", { repositoryUrl: repo.url, context: "./app", platform: "linux/amd64",});
// Deploy an ECS Service on Fargate to host the application containerconst service = new awsx.ecs.FargateService("service", { cluster: cluster.arn, assignPublicIp: true, taskDefinitionArgs: { container: { name: "app", image: image.imageUri, cpu: cpu, memory: memory, essential: true, portMappings: [{ containerPort: containerPort, targetGroup: loadbalancer.defaultTargetGroup, }], }, },});
// The URL at which the container's HTTP endpoint will be availableexport const url = pulumi.interpolate`http://${loadbalancer.loadBalancer.dnsName}`;
// The name of the ECS clusterexport const clusterName = cluster.name;from pulumi import Config, Output, exportimport pulumi_aws as awsimport pulumi_awsx as awsx
config = Config()container_port = config.get_int("containerPort", 80)cpu = config.get_int("cpu", 512)memory = config.get_int("memory", 128)
# An ECS cluster to deploy intocluster = aws.ecs.Cluster("cluster")
# An ALB to serve the container endpoint to the internetloadbalancer = awsx.lb.ApplicationLoadBalancer("loadbalancer")
# An ECR repository to store the application's container imagerepo = awsx.ecr.Repository("repo", force_delete=True)
# Build and publish the application's container image from ./app to the ECR repositoryimage = awsx.ecr.Image( "image", repository_url=repo.url, context="./app", platform="linux/amd64")
# Deploy an ECS Service on Fargate to host the application containerservice = awsx.ecs.FargateService( "service", cluster=cluster.arn, assign_public_ip=True, task_definition_args={ "container": { "name": "app", "image": image.image_uri, "cpu": cpu, "memory": memory, "essential": True, "port_mappings": [ { "container_port": container_port, "target_group": loadbalancer.default_target_group, } ], }, },)
# The URL at which the container's HTTP endpoint will be availableexport("url", Output.concat("http://", loadbalancer.load_balancer.dns_name))
# The name of the ECS clusterexport("clusterName", cluster.name)package main
import ( "github.com/pulumi/pulumi-aws/sdk/v7/go/aws/ecs" "github.com/pulumi/pulumi-awsx/sdk/v3/go/awsx/ecr" ecrx "github.com/pulumi/pulumi-awsx/sdk/v3/go/awsx/ecr" ecsx "github.com/pulumi/pulumi-awsx/sdk/v3/go/awsx/ecs" lbx "github.com/pulumi/pulumi-awsx/sdk/v3/go/awsx/lb" "github.com/pulumi/pulumi/sdk/v3/go/pulumi" "github.com/pulumi/pulumi/sdk/v3/go/pulumi/config")
func main() { pulumi.Run(func(ctx *pulumi.Context) error { cfg := config.New(ctx, "") containerPort := 80 if param := cfg.GetInt("containerPort"); param != 0 { containerPort = param } cpu := 512 if param := cfg.GetInt("cpu"); param != 0 { cpu = param } memory := 128 if param := cfg.GetInt("memory"); param != 0 { memory = param }
// An ECS cluster to deploy into cluster, err := ecs.NewCluster(ctx, "cluster", nil) if err != nil { return err }
// An ALB to serve the container endpoint to the internet loadbalancer, err := lbx.NewApplicationLoadBalancer(ctx, "loadbalancer", nil) if err != nil { return err }
// An ECR repository to store the application's container image repo, err := ecrx.NewRepository(ctx, "repo", &ecrx.RepositoryArgs{ ForceDelete: pulumi.Bool(true), }) if err != nil { return err }
// Build and publish the application's container image from ./app to the ECR repository image, err := ecrx.NewImage(ctx, "image", &ecr.ImageArgs{ RepositoryUrl: repo.Url, Context: pulumi.String("./app"), Platform: pulumi.String("linux/amd64"), }) if err != nil { return err }
// Deploy an ECS Service on Fargate to host the application container _, err = ecsx.NewFargateService(ctx, "service", &ecsx.FargateServiceArgs{ Cluster: cluster.Arn, AssignPublicIp: pulumi.Bool(true), TaskDefinitionArgs: &ecsx.FargateServiceTaskDefinitionArgs{ Container: &ecsx.TaskDefinitionContainerDefinitionArgs{ Name: pulumi.String("app"), Image: image.ImageUri, Cpu: pulumi.Int(cpu), Memory: pulumi.Int(memory), Essential: pulumi.Bool(true), PortMappings: ecsx.TaskDefinitionPortMappingArray{ &ecsx.TaskDefinitionPortMappingArgs{ ContainerPort: pulumi.Int(containerPort), TargetGroup: loadbalancer.DefaultTargetGroup, }, }, }, }, }) if err != nil { return err }
// The URL at which the container's HTTP endpoint will be available ctx.Export("url", pulumi.Sprintf("http://%s", loadbalancer.LoadBalancer.DnsName()))
// The name of the ECS cluster ctx.Export("clusterName", cluster.Name) return nil })}using System.Collections.Generic;using Pulumi;using Aws = Pulumi.Aws;using Awsx = Pulumi.Awsx;
return await Deployment.RunAsync(() =>{ var config = new Config(); var containerPort = config.GetInt32("containerPort") ?? 80; var cpu = config.GetInt32("cpu") ?? 512; var memory = config.GetInt32("memory") ?? 128; var cluster = new Aws.Ecs.Cluster("cluster");
var loadbalancer = new Awsx.Lb.ApplicationLoadBalancer("loadbalancer");
var repo = new Awsx.Ecr.Repository("repo", new() { ForceDelete = true, });
var image = new Awsx.Ecr.Image("image", new() { RepositoryUrl = repo.Url, Context = "./app", Platform = "linux/amd64", });
var service = new Awsx.Ecs.FargateService("service", new() { Cluster = cluster.Arn, AssignPublicIp = true, TaskDefinitionArgs = new Awsx.Ecs.Inputs.FargateServiceTaskDefinitionArgs { Container = new Awsx.Ecs.Inputs.TaskDefinitionContainerDefinitionArgs { Name = "app", Image = image.ImageUri, Cpu = cpu, Memory = memory, Essential = true, PortMappings = new[] { new Awsx.Ecs.Inputs.TaskDefinitionPortMappingArgs { ContainerPort = containerPort, TargetGroup = loadbalancer.DefaultTargetGroup, }, }, }, }, });
return new Dictionary<string, object?> { ["url"] = loadbalancer.LoadBalancer.Apply(loadBalancer => Output.Format($"http://{loadBalancer.DnsName}")), ["clusterName"] = cluster.Name, };});name: my-projectdescription: A Pulumi YAML program to deploy a containerized service on AWSruntime: yamlconfig: containerPort: default: 80 cpu: default: 512 memory: default: 128
resources:
# An ECS cluster to deploy into cluster: type: aws:ecs:Cluster
# An ALB to serve the container endpoint to the internet loadbalancer: type: awsx:lb:ApplicationLoadBalancer
# An ECR repository to store the application's container image repo: type: awsx:ecr:Repository properties: forceDelete: true
# Build and publish the application's container image from ./app to the ECR repository image: type: awsx:ecr:Image properties: repositoryUrl: ${repo.url} context: ./app platform: linux/amd64
# Deploy an ECS Service on Fargate to host the application container service: type: awsx:ecs:FargateService properties: cluster: ${cluster.arn} assignPublicIp: true taskDefinitionArgs: container: name: app image: ${image.imageUri} cpu: ${cpu} memory: ${memory} essential: true portMappings: - containerPort: ${containerPort} targetGroup: ${loadbalancer.defaultTargetGroup}
outputs:
# The URL at which the container's HTTP endpoint will be available url: http://${loadbalancer.loadBalancer.dnsName}
# The name of the ECS cluster clusterName: ${cluster.name}terraform { required_providers { aws = { source = "pulumi/aws" } awsx = { source = "pulumi/awsx" } }}
variable "container_port" { description = "The port to expose on the container" type = number default = 80}
variable "cpu" { description = "The amount of CPU to allocate for the container" type = number default = 512}
variable "memory" { description = "The amount of memory to allocate for the container" type = number default = 128}
# An ECS cluster to deploy intoresource "aws_ecs_cluster" "cluster" {}
# An ALB to serve the container endpoint to the internetresource "awsx_lb_application_load_balancer" "loadbalancer" {}
# An ECR repository to store the application's container imageresource "awsx_ecr_repository" "repo" { force_delete = true}
# Build and publish the application's container image from ./app to the ECR repositoryresource "awsx_ecr_image" "image" { repository_url = awsx_ecr_repository.repo.url context = "./app" platform = "linux/amd64"}
# Deploy an ECS Service on Fargate to host the application containerresource "awsx_ecs_fargate_service" "service" { cluster = aws_ecs_cluster.cluster.arn assign_public_ip = true
task_definition_args = { container = { name = "app" image = awsx_ecr_image.image.image_uri cpu = var.cpu memory = var.memory essential = true port_mappings = [{ container_port = var.container_port target_group = awsx_lb_application_load_balancer.loadbalancer.default_target_group }] } }}
# The URL at which the container's HTTP endpoint will be availableoutput "url" { value = "http://${awsx_lb_application_load_balancer.loadbalancer.load_balancer.dns_name}"}
# The name of the ECS clusteroutput "cluster_name" { value = aws_ecs_cluster.cluster.name}Deploy the project#
Deploy with pulumi up. It starts with a preview of what it’s about to create and asks before it changes anything. Choose yes to deploy.
Pulumi builds the container image with Docker on your machine, so Docker needs to be running.
pulumi uppulumi upPulumi adds a random suffix to most resource names, so the ECS cluster cluster becomes something like cluster-4f8a2c1. This is autonaming. It lets you deploy the same program to more than one stack, and lets Pulumi create a replacement before it deletes the old resource, without names colliding.
When it finishes, Pulumi prints the stack’s outputs, values it only knows once the resources exist:
- url
The HTTP URL for the container’s endpoint.
- clusterName
The name of the ECS cluster.
- url
The HTTP URL for the container’s endpoint.
- clusterName
The name of the ECS cluster.
- url
The HTTP URL for the container’s endpoint.
- clusterName
The name of the ECS cluster.
- url
The HTTP URL for the container’s endpoint.
- clusterName
The name of the ECS cluster.
- url
The HTTP URL for the container’s endpoint.
- clusterName
The name of the ECS cluster.
- url
The HTTP URL for the container’s endpoint.
- cluster_name
The name of the ECS cluster.
Read one any time with pulumi stack output <name>, or pass it to another command. This opens the service in your browser:
open $(pulumi stack output url)xdg-open $(pulumi stack output url)Start-Process $(pulumi stack output url)To check it from the terminal, fetch the page and print its title:
curl -s $(pulumi stack output url) | grep "<title>"<title>Welcome to nginx!</title>curl.exe -s $(pulumi stack output url) | Select-String "<title>"<title>Welcome to nginx!</title>If the title says 503, the load balancer is still checking the new task. Wait a minute and run it again.
Need help?
If pulumi up reports No valid credential sources found or ExpiredToken, sign in again:
aws loginaws loginStill stuck? Let us know.
Customize the project#
Projects created with this template expose the following configuration settings:
- containerPort
Specifies the port mapping for the container. Defaults to port 80.
- cpu
Specifies the amount of CPU to use with each task or each container within a task. Defaults to 512.
- memory
Specifies the amount of memory to use with each task or each container within a task. Defaults to 128.
- containerPort
Specifies the port mapping for the container. Defaults to port 80.
- cpu
Specifies the amount of CPU to use with each task or each container within a task. Defaults to 512.
- memory
Specifies the amount of memory to use with each task or each container within a task. Defaults to 128.
- containerPort
Specifies the port mapping for the container. Defaults to port 80.
- cpu
Specifies the amount of CPU to use with each task or each container within a task. Defaults to 512.
- memory
Specifies the amount of memory to use with each task or each container within a task. Defaults to 128.
- containerPort
Specifies the port mapping for the container. Defaults to port 80.
- cpu
Specifies the amount of CPU to use with each task or each container within a task. Defaults to 512.
- memory
Specifies the amount of memory to use with each task or each container within a task. Defaults to 128.
- containerPort
Specifies the port mapping for the container. Defaults to port 80.
- cpu
Specifies the amount of CPU to use with each task or each container within a task. Defaults to 512.
- memory
Specifies the amount of memory to use with each task or each container within a task. Defaults to 128.
- container_port
Specifies the port mapping for the container. Defaults to port 80.
- cpu
Specifies the amount of CPU to use with each task or each container within a task. Defaults to 512.
- memory
Specifies the amount of memory to use with each task or each container within a task. Defaults to 128.
All of these settings are optional and may be adjusted either by editing the stack configuration file directly (by default, Pulumi.dev.yaml) or by changing their values with pulumi config set.
For example, give the container 256 MiB of memory:
pulumi config set memory 256pulumi uppulumi config set memory 256pulumi uppulumi up registers a new task definition and replaces the running task with one that has the new limit. To see it, ask the stack’s ECS cluster for its task’s memory:
export AWS_DEFAULT_REGION=$(pulumi config get aws:region)CLUSTER=$(pulumi stack output clusterName)aws ecs describe-tasks --cluster "$CLUSTER" \ --tasks $(aws ecs list-tasks --cluster "$CLUSTER" --query "taskArns" --output text) \ --query "tasks[].containers[].memory" --output text256$env:AWS_DEFAULT_REGION = pulumi config get aws:region$CLUSTER = pulumi stack output clusterName$TASKS = (aws ecs list-tasks --cluster $CLUSTER --query "taskArns" --output text) -split '\s+'aws ecs describe-tasks --cluster $CLUSTER --tasks $TASKS ` --query "tasks[].containers[].memory" --output text256export AWS_DEFAULT_REGION=$(pulumi config get aws:region)CLUSTER=$(pulumi stack output clusterName)aws ecs describe-tasks --cluster "$CLUSTER" \ --tasks $(aws ecs list-tasks --cluster "$CLUSTER" --query "taskArns" --output text) \ --query "tasks[].containers[].memory" --output text256$env:AWS_DEFAULT_REGION = pulumi config get aws:region$CLUSTER = pulumi stack output clusterName$TASKS = (aws ecs list-tasks --cluster $CLUSTER --query "taskArns" --output text) -split '\s+'aws ecs describe-tasks --cluster $CLUSTER --tasks $TASKS ` --query "tasks[].containers[].memory" --output text256export AWS_DEFAULT_REGION=$(pulumi config get aws:region)CLUSTER=$(pulumi stack output clusterName)aws ecs describe-tasks --cluster "$CLUSTER" \ --tasks $(aws ecs list-tasks --cluster "$CLUSTER" --query "taskArns" --output text) \ --query "tasks[].containers[].memory" --output text256$env:AWS_DEFAULT_REGION = pulumi config get aws:region$CLUSTER = pulumi stack output clusterName$TASKS = (aws ecs list-tasks --cluster $CLUSTER --query "taskArns" --output text) -split '\s+'aws ecs describe-tasks --cluster $CLUSTER --tasks $TASKS ` --query "tasks[].containers[].memory" --output text256export AWS_DEFAULT_REGION=$(pulumi config get aws:region)CLUSTER=$(pulumi stack output clusterName)aws ecs describe-tasks --cluster "$CLUSTER" \ --tasks $(aws ecs list-tasks --cluster "$CLUSTER" --query "taskArns" --output text) \ --query "tasks[].containers[].memory" --output text256$env:AWS_DEFAULT_REGION = pulumi config get aws:region$CLUSTER = pulumi stack output clusterName$TASKS = (aws ecs list-tasks --cluster $CLUSTER --query "taskArns" --output text) -split '\s+'aws ecs describe-tasks --cluster $CLUSTER --tasks $TASKS ` --query "tasks[].containers[].memory" --output text256export AWS_DEFAULT_REGION=$(pulumi config get aws:region)CLUSTER=$(pulumi stack output clusterName)aws ecs describe-tasks --cluster "$CLUSTER" \ --tasks $(aws ecs list-tasks --cluster "$CLUSTER" --query "taskArns" --output text) \ --query "tasks[].containers[].memory" --output text256$env:AWS_DEFAULT_REGION = pulumi config get aws:region$CLUSTER = pulumi stack output clusterName$TASKS = (aws ecs list-tasks --cluster $CLUSTER --query "taskArns" --output text) -split '\s+'aws ecs describe-tasks --cluster $CLUSTER --tasks $TASKS ` --query "tasks[].containers[].memory" --output text256export AWS_DEFAULT_REGION=$(pulumi config get aws:region)CLUSTER=$(pulumi stack output cluster_name)aws ecs describe-tasks --cluster "$CLUSTER" \ --tasks $(aws ecs list-tasks --cluster "$CLUSTER" --query "taskArns" --output text) \ --query "tasks[].containers[].memory" --output text256$env:AWS_DEFAULT_REGION = pulumi config get aws:region$CLUSTER = pulumi stack output cluster_name$TASKS = (aws ecs list-tasks --cluster $CLUSTER --query "taskArns" --output text) -split '\s+'aws ecs describe-tasks --cluster $CLUSTER --tasks $TASKS ` --query "tasks[].containers[].memory" --output text256Using your own container image#
If you already have a container image you’d like to build your container service with, replace the Dockerfile and application code in the app folder, then redeploy with pulumi up.
To see what else you can add, browse the AWS provider in the Pulumi Registry.
Cleaning up#
You can cleanly destroy the stack and all of its infrastructure with pulumi destroy:
pulumi destroypulumi destroyLearn more#
- Browse other architecture templates in the Templates gallery.
- Explore the AWS and AWSx provider API docs in the Pulumi Registry.
- Walk through Pulumi from the ground up in Pulumi Tutorials.
- Read the latest container posts on the Pulumi blog.