forked from pulumi/examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.ts
26 lines (22 loc) · 985 Bytes
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Copyright 2016-2019, Pulumi Corporation. All rights reserved.
import * as awsx from "@pulumi/awsx";
import * as pulumi from "@pulumi/pulumi";
// Create an elastic network listener to listen for requests and route them to the container.
// See https://docs.aws.amazon.com/elasticloadbalancing/latest/network/introduction.html
// for more details.
const listener = new awsx.elasticloadbalancingv2.NetworkListener("nginx", { port: 80 });
// Define the service to run. We pass in the listener to hook up the network load balancer
// to the containers the service will launch.
const service = new awsx.ecs.FargateService("nginx", {
desiredCount: 3,
taskDefinitionArgs: {
containers: {
nginx: {
image: awsx.ecs.Image.fromPath("nginx", "./app"),
memory: 512,
portMappings: [listener],
},
},
},
});
export let frontendURL = pulumi.interpolate `http://${listener.endpoint.hostname}/`;