Skip to content

Commit 3710d09

Browse files
author
Vibhas
committed
Keypair + AMI
1 parent 982dde3 commit 3710d09

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

index.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@ Parameters:
2525
Description: The path to register with the Application Load Balancer
2626
Type: String
2727
Default: /dept
28+
Ec2AmiId:
29+
Description: AMI Id for EC2 Instance (Use amazon ECS optimized AMI only)
30+
Type: AWS::EC2::Image::Id
31+
Default: ami-0b22c910bce7178b6
32+
KeyPair:
33+
Description: KeyPair name to SSH into Instance
34+
Type: AWS::EC2::KeyPair::KeyName
2835

2936

3037
Resources:
@@ -63,6 +70,8 @@ Resources:
6370
EC2ClusterSecurityGroup: !GetAtt SecurityGroupsStack.Outputs.EC2ClusterSecurityGroup
6471
SshSecurityGroup: !GetAtt SecurityGroupsStack.Outputs.SshSecurityGroup
6572
Ec2InstanceType: !Ref Ec2InstanceType
73+
Ec2AmiId: !Ref Ec2AmiId
74+
KeyPair: !Ref KeyPair
6675
TimeoutInMinutes: 5
6776

6877
LogGroupStack:

infrastructure/ecs-cluster.yaml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ Parameters:
2121
m5.large, m5.xlarge, m5.2large, m5.4xlarge, m5.12xlarge, m5.24large,
2222
c5.large, c5.xlarge, c5.2xlarge, c5.4xlarge, c5.9xlarge, c5.18xlarge,
2323
r5.large, r5.xlarge, r5.2xlarge, r5.4xlarge, r5.12xlarge, r5.24xlarge ]
24+
Ec2AmiId:
25+
Description: AMI Id for EC2 Instance (Use amazon ECS optimized AMI only)
26+
Type: AWS::EC2::Image::Id
27+
Default: ami-0b22c910bce7178b6
28+
KeyPair:
29+
Description: KeyPair name to SSH into Instance
30+
Type: AWS::EC2::KeyPair::KeyName
2431

2532

2633

@@ -51,8 +58,8 @@ Resources:
5158
AutoScalingGroupLaunchConfiguration:
5259
Type: AWS::AutoScaling::LaunchConfiguration
5360
Properties:
54-
KeyName: ecs-poc
55-
ImageId: ami-07a63940735aebd38
61+
KeyName: !Ref KeyPair
62+
ImageId: !Ref Ec2AmiId
5663
InstanceType: !Ref Ec2InstanceType
5764
IamInstanceProfile: ecsInstanceRole
5865
SecurityGroups:
@@ -62,9 +69,8 @@ Resources:
6269
Fn::Base64:
6370
Fn::Sub:
6471
- |
65-
#!/bin/bash -xe
72+
#!/bin/bash
6673
echo ECS_CLUSTER=${ECSCluster} >> /etc/ecs/ecs.config
67-
yum install -y aws-cfn-bootstrap
6874
- { ECSCluster: !Ref Cluster }
6975

7076
Outputs:

0 commit comments

Comments
 (0)