The vpc is read in via StackReferences and built via awsx.
The ecs cluster is stood up via awsx package.
The load balancer is built via the aws package. There are no targetgroups or listeners created on purpose.
The ecs cluster and the load balancer are exported via stackreference
- Install Pulumi
- Configure Pulumi to Use AWS (if your AWS CLI is configured, no further changes are required)
- Vpc already created. You can create it via aws-classic-ts-vpc-crosswalk or any other method
The settings are in Pulumi
.stackname.yaml
You will be creating a new file that holds your configs
-
Initialize a new stack called:
dev
via pulumi stack init. Pulumi.dev.yaml wil be createdpulumi stack init dev
-
Now, install dependencies.
npm install
-
View the current config settings. This will be empty.
pulumi config
KEY VALUE
The config values are empty
-
Populate the config. The networking stack follows this means that the format is // See networkingStack below for example
Here are aws endpoints
pulumi config set aws:region us-east-2 # needs to match the region where the vpc is stood up. networkingStack myuser/crosswalk-vpc/myvpc #
-
View the current config settings
pulumi config
KEY VALUE aws:region us-east-2 networkingStack myuser/crosswalk-vpc/myvpc
-
Special Considerations.
- We are using an existing vpc. This MUST already exist otherwise this stack will FAIL.
- We are not creating an awsx loadbalancer, we must use aws because we have to pass in the load balancer resource when we create the fargate resources in the next stack.
- We are not creating a targetgroup or targetlistener via awsx.
- Next stack name is:
-
Create the stack via pulumi up
pulumi up -y
The Result will be
Do you want to perform this update? yes Updating (dev) Updating (dev) View Live: https://app.pulumi.com/myuser/aws-ts-ecs-awsx/dev/updates/22 Type Name Status + pulumi:pulumi:Stack aws-ts-ecs-awsx-dev created + ├─ awsx:x:ecs:Cluster demo-ecs created + │ ├─ awsx:x:ec2:SecurityGroup demo-ecs created + │ │ ├─ awsx:x:ec2:IngressSecurityGroupRule demo-ecs-containers created + │ │ │ └─ aws:ec2:SecurityGroupRule demo-ecs-containers created + │ │ ├─ awsx:x:ec2:EgressSecurityGroupRule demo-ecs-egress created + │ │ │ └─ aws:ec2:SecurityGroupRule demo-ecs-egress created + │ │ ├─ awsx:x:ec2:IngressSecurityGroupRule demo-ecs-ssh created + │ │ │ └─ aws:ec2:SecurityGroupRule demo-ecs-ssh created + │ │ └─ aws:ec2:SecurityGroup demo-ecs created + │ └─ aws:ecs:Cluster demo-ecs created + ├─ awsx:x:ec2:Vpc demo-getvpc created + ├─ aws:ec2:SecurityGroup demo-securitygroup created + └─ aws:alb:LoadBalancer demo-alb created Outputs: cluster_id : "secret" cluster_name : "demo-ecs-cac746f" load_balancer_arn : "secret" load_balancer_name: "demo-alb-fc410af" myvpc : "secret" securitygroup_id : "sg-019dc06000745551a" securitygroup_name: "demo-securitygroup-348b57b" Resources: + 14 created Duration: 3m14s
-
Check out the stack Outputs
pulumi stack output
Results
Current stack outputs (7): OUTPUT VALUE cluster_id [secret] cluster_name demo-ecs-a8c72a4 load_balancer_arn [secret] load_balancer_name demo-alb-347c1d1 securitygroup_id sg-03627b0949fbd9b8a securitygroup_name demo-securitygroup-b5256cf vpc_existing [secret]
-
View the outputs.
pulumi stack output
If you need to see the values that are secrets, do the following
pulumi stack output --show-secrets
-
The value to use in a StackReference can be retrieved from the last line.
pulumi stack
Results
.. .. More information at: https://app.pulumi.com/myuser/aws-ts-ecs-awsx/dev
We want the following from the above myuser/aws-ts-ecs-awsx/dev so that we can use it in aws-ts-get-ecs
-
Destroy the stack (Only AFTER you have destroyed the stack that depends on this: aws-ts-get-ecs)
pulumi destroy -y
-
Remove the stack
pulumi stack rm dev -y