Last active
August 7, 2019 05:21
-
-
Save sakamaki-kazuyoshi/f39b268d9a05d3fd70a417cbe15507cf 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' | |
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment