Created
October 4, 2019 05:19
-
-
Save devops-school/9e5f55626d7fd09f7b72bcb6b0508630 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"AWSTemplateFormatVersion": "2010-09-09", | |
"Description": "EC2-SecurityGroup-ElasticIP", | |
"Parameters": { | |
"VPC": { | |
"Description": "The default VPC", | |
"Type": "AWS::EC2::VPC::Id" | |
}, | |
"Subnet": { | |
"Description": "A public subnet of VPC.", | |
"Type": "AWS::EC2::Subnet::Id" | |
}, | |
"KeyPair": { | |
"Description": "A SSH key pair.", | |
"Type": "AWS::EC2::KeyPair::KeyName" | |
} | |
}, | |
"Mappings": { | |
"RegionMap": { | |
"eu-west-1": {"AMI": "ami-bff32ccc"}, | |
"ap-southeast-1": {"AMI": "ami-c9b572aa"}, | |
"ap-southeast-2": {"AMI": "ami-48d38c2b"}, | |
"eu-central-1": {"AMI": "ami-bc5b48d0"}, | |
"ap-northeast-2": {"AMI": "ami-249b554a"}, | |
"ap-northeast-1": {"AMI": "ami-383c1956"}, | |
"us-east-1": {"AMI": "ami-60b6c60a"}, | |
"sa-east-1": {"AMI": "ami-6817af04"}, | |
"us-west-1": {"AMI": "ami-d5ea86b5"}, | |
"us-west-2": {"AMI": "ami-f0091d91"} | |
} | |
}, | |
"Resources": { | |
"EC2Instance": { | |
"Type": "AWS::EC2::Instance", | |
"Properties": { | |
"ImageId": {"Fn::FindInMap": ["RegionMap", {"Ref": "AWS::Region"}, "AMI"]}, | |
"InstanceType": "t2.nano", | |
"NetworkInterfaces": [{ | |
"AssociatePublicIpAddress": "true", | |
"DeviceIndex": "0", | |
"GroupSet": [{"Ref": "SecurityGroup"}], | |
"SubnetId": {"Ref": "Subnet"} | |
}], | |
"Tags": [{ | |
"Key": "Name", | |
"Value": "ssh-bastion-host" | |
}], | |
"KeyName": {"Ref": "KeyPair"} | |
} | |
}, | |
"ElasticIP": { | |
"Type": "AWS::EC2::EIP", | |
"Properties": { | |
"InstanceId": {"Ref": "EC2Instance"}, | |
"Domain": "vpc" | |
} | |
}, | |
"SecurityGroup": { | |
"Type": "AWS::EC2::SecurityGroup", | |
"Properties": { | |
"GroupDescription": "ssh-bastion-host", | |
"VpcId": {"Ref": "VPC"}, | |
"SecurityGroupIngress": [{ | |
"CidrIp": "0.0.0.0/0", | |
"FromPort": 22, | |
"IpProtocol": "tcp", | |
"ToPort": 22 | |
}] | |
} | |
} | |
}, | |
"Outputs": { | |
"SSHBastionHost": { | |
"Description": "Public IP address of SSH bastion host.", | |
"Value": {"Ref": "ElasticIP"} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment