Skip to content

Commit

Permalink
Keypair + AMI
Browse files Browse the repository at this point in the history
  • Loading branch information
Vibhas committed Jun 13, 2020
1 parent 982dde3 commit 3710d09
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
9 changes: 9 additions & 0 deletions index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ Parameters:
Description: The path to register with the Application Load Balancer
Type: String
Default: /dept
Ec2AmiId:
Description: AMI Id for EC2 Instance (Use amazon ECS optimized AMI only)
Type: AWS::EC2::Image::Id
Default: ami-0b22c910bce7178b6
KeyPair:
Description: KeyPair name to SSH into Instance
Type: AWS::EC2::KeyPair::KeyName


Resources:
Expand Down Expand Up @@ -63,6 +70,8 @@ Resources:
EC2ClusterSecurityGroup: !GetAtt SecurityGroupsStack.Outputs.EC2ClusterSecurityGroup
SshSecurityGroup: !GetAtt SecurityGroupsStack.Outputs.SshSecurityGroup
Ec2InstanceType: !Ref Ec2InstanceType
Ec2AmiId: !Ref Ec2AmiId
KeyPair: !Ref KeyPair
TimeoutInMinutes: 5

LogGroupStack:
Expand Down
14 changes: 10 additions & 4 deletions infrastructure/ecs-cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ Parameters:
m5.large, m5.xlarge, m5.2large, m5.4xlarge, m5.12xlarge, m5.24large,
c5.large, c5.xlarge, c5.2xlarge, c5.4xlarge, c5.9xlarge, c5.18xlarge,
r5.large, r5.xlarge, r5.2xlarge, r5.4xlarge, r5.12xlarge, r5.24xlarge ]
Ec2AmiId:
Description: AMI Id for EC2 Instance (Use amazon ECS optimized AMI only)
Type: AWS::EC2::Image::Id
Default: ami-0b22c910bce7178b6
KeyPair:
Description: KeyPair name to SSH into Instance
Type: AWS::EC2::KeyPair::KeyName



Expand Down Expand Up @@ -51,8 +58,8 @@ Resources:
AutoScalingGroupLaunchConfiguration:
Type: AWS::AutoScaling::LaunchConfiguration
Properties:
KeyName: ecs-poc
ImageId: ami-07a63940735aebd38
KeyName: !Ref KeyPair
ImageId: !Ref Ec2AmiId
InstanceType: !Ref Ec2InstanceType
IamInstanceProfile: ecsInstanceRole
SecurityGroups:
Expand All @@ -62,9 +69,8 @@ Resources:
Fn::Base64:
Fn::Sub:
- |
#!/bin/bash -xe
#!/bin/bash
echo ECS_CLUSTER=${ECSCluster} >> /etc/ecs/ecs.config
yum install -y aws-cfn-bootstrap
- { ECSCluster: !Ref Cluster }

Outputs:
Expand Down

0 comments on commit 3710d09

Please sign in to comment.