Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- AWSTemplateFormatVersion: '2010-09-09'
- Parameters:
- projectName:
- Type: String
- eC2KeyPair:
- Type: AWS::EC2::KeyPair::KeyName
- Resources:
- vpc:
- Type: 'AWS::EC2::VPC'
- Properties:
- CidrBlock: 10.0.0.0/16
- EnableDnsSupport: 'true'
- EnableDnsHostnames: 'true'
- InstanceTenancy: default
- Tags:
- - Key: Name
- Value: !Sub ${projectName}-vpc
- igw:
- Type: "AWS::EC2::InternetGateway"
- Properties:
- Tags:
- - Key: Name
- Value: !Sub ${projectName}-igw
- attachmentigw:
- Type: "AWS::EC2::VPCGatewayAttachment"
- Properties:
- VpcId: !Ref vpc
- InternetGatewayId: !Ref igw
- rtb:
- Type: "AWS::EC2::RouteTable"
- Properties:
- VpcId: !Ref vpc
- Tags:
- - Key: Name
- Value: !Sub ${projectName}-rtb
- rtbRoute:
- Type: "AWS::EC2::Route"
- Properties:
- DestinationCidrBlock: 0.0.0.0/0
- GatewayId: !Ref igw
- RouteTableId: !Ref rtb
- subnet1:
- Type: 'AWS::EC2::Subnet'
- Properties:
- VpcId: !Ref vpc
- AvailabilityZone: 'ap-northeast-1a'
- CidrBlock: 10.0.0.0/24
- Tags:
- - Key: Name
- Value: !Sub ${projectName}-public-subnet01
- subnet2:
- Type: 'AWS::EC2::Subnet'
- Properties:
- VpcId: !Ref vpc
- AvailabilityZone: 'ap-northeast-1c'
- CidrBlock: 10.0.1.0/24
- Tags:
- - Key: Name
- Value: !Sub ${projectName}-public-subnet02
- publicSubnet1:
- Type: "AWS::EC2::SubnetRouteTableAssociation"
- Properties:
- SubnetId: !Ref subnet1
- RouteTableId: !Ref rtb
- publicSubnet2:
- Type: "AWS::EC2::SubnetRouteTableAssociation"
- Properties:
- SubnetId: !Ref subnet2
- RouteTableId: !Ref rtb
- ec2Securitygroup:
- Type: "AWS::EC2::SecurityGroup"
- Properties:
- VpcId: !Ref vpc
- GroupName: !Sub ${projectName}-ec2-sg
- GroupDescription: !Sub ${projectName}-ec2-sg
- SecurityGroupIngress:
- - IpProtocol: tcp
- FromPort: '3389'
- ToPort: '3389'
- CidrIp: 0.0.0.0/0
- Tags:
- - Key: Name
- Value: !Sub ${projectName}-ec2-sg
- windowsServer:
- Type: "AWS::EC2::Instance"
- Properties:
- KeyName: !Ref eC2KeyPair
- ImageId: ami-0bc8442658e36a4d2 # Windows_Server-2016-Japanese-Full-Base-2019.07.12
- InstanceType: t3.small
- BlockDeviceMappings:
- - DeviceName: /dev/sda1
- Ebs:
- VolumeType: gp2
- VolumeSize: 30
- AvailabilityZone: ap-northeast-1a
- NetworkInterfaces:
- - AssociatePublicIpAddress: true
- DeviceIndex: "0"
- GroupSet:
- - !Ref ec2Securitygroup
- SubnetId: !Ref subnet1
- Tags:
- - Key: Name
- Value: !Sub ${projectName}-ec2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement