Created
September 27, 2020 06:46
-
-
Save renganatha10/14db82b8a91a06562847b19228b11ef5 to your computer and use it in GitHub Desktop.
Cloud Formation for Deep Dive VPC
This file contains 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
Resources: | |
VPC: | |
Type: AWS::EC2::VPC | |
Properties: | |
CidrBlock: 10.1.0.0/16 | |
EnableDnsSupport: true | |
EnableDnsHostnames: true | |
Tags: | |
- Key: Name | |
Value: !Sub ${AWS::StackName}-web-pub | |
WebPubSubnet: | |
Type: AWS::EC2::Subnet | |
Properties: | |
VpcId: !Ref VPC | |
CidrBlock: 10.1.254.0/24 | |
AvailabilityZone: !Select [0, !GetAZs ] | |
Tags: | |
- Key: Name | |
Value: !Sub ${AWS::StackName}-web-pub | |
WebPubRouteTable: | |
Type: AWS::EC2::RouteTable | |
Properties: | |
VpcId: !Ref VPC | |
Tags: | |
- Key: Name | |
Value: !Sub ${AWS::StackName}-web-pub | |
WebPubSubnetAssociation: | |
Type: AWS::EC2::SubnetRouteTableAssociation | |
Properties: | |
RouteTableId: !Ref WebPubRouteTable | |
SubnetId: !Ref WebPubSubnet | |
WebPubInternetGateway: | |
Type: AWS::EC2::InternetGateway | |
Properties: | |
Tags: | |
- Key: Name | |
Value: !Sub ${AWS::StackName}-web-igw | |
WebPubIGWAssociation: | |
Type: AWS::EC2::VPCGatewayAttachment | |
Properties: | |
InternetGatewayId: !Ref WebPubInternetGateway | |
VpcId: !Ref VPC | |
WebPubRoute: | |
Type: AWS::EC2::Route | |
Properties: | |
RouteTableId: !Ref WebPubRouteTable | |
DestinationCidrBlock: 0.0.0.0/0 | |
GatewayId: !Ref WebPubInternetGateway | |
WebPubSG: | |
Type: AWS::EC2::SecurityGroup | |
Properties: | |
GroupDescription: !Sub ${AWS::StackName}-web-sg | |
VpcId: !Ref VPC | |
SecurityGroupIngress: | |
- CidrIp: 106.208.33.129/32 | |
Description: SSH ME | |
IpProtocol: tcp | |
ToPort: 22 | |
FromPort: 22 | |
- CidrIp: 0.0.0.0/0 | |
Description: the world | |
IpProtocol: tcp | |
ToPort: 80 | |
FromPort: 80 | |
WebPubElasticNetworkInterface: | |
Type: AWS::EC2::NetworkInterface | |
Properties: | |
Description: ENI for web pub instance | |
PrivateIpAddress: 10.1.254.10 | |
SubnetId: !Ref WebPubSubnet | |
GroupSet: | |
- !Ref WebPubSG | |
Tags: | |
- Key: Name | |
Value: !Sub ${AWS::StackName}-web-pub-eni | |
WebPubElasticIp: | |
Type: AWS::EC2::EIP | |
Properties: | |
Domain: vpc | |
Tags: | |
- Key: Name | |
Value: !Sub ${AWS::StackName}-web-pub-eip | |
WebPubElasticAddressAssociation: | |
Type: AWS::EC2::EIPAssociation | |
Properties: | |
AllocationId: !GetAtt WebPubElasticIp.AllocationId | |
NetworkInterfaceId: !Ref WebPubElasticNetworkInterface | |
WebPubInstance: | |
Type: AWS::EC2::Instance | |
Properties: | |
ImageId: ami-0032590ffd0e92954 | |
InstanceType: t2.small | |
KeyName: vpc-deepdive | |
NetworkInterfaces: | |
- NetworkInterfaceId: !Ref WebPubElasticNetworkInterface | |
DeviceIndex: 0 | |
Tags: | |
- Key: Name | |
Value: !Sub ${AWS::StackName}-web-pub-ec2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment