Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- AWSTemplateFormatVersion: '2010-09-09'
- Description: 'AWS CloudFormation Sample Template'
- Parameters:
- KeyName:
- Type: AWS::EC2::KeyPair::KeyName
- Default: keypair
- InstanceType:
- Type: String
- Default: t2.micro
- ImageId:
- Type: String
- Default: ami-08935252a36e25f85
- Resources:
- EC2Instance:
- Type: AWS::EC2::Instance
- Properties:
- InstanceType: !Ref InstanceType
- SecurityGroups:
- - Ref: InstanceSecurityGroup
- KeyName: !Ref KeyName
- ImageId: !Ref ImageId
- InstanceSecurityGroup:
- Type: AWS::EC2::SecurityGroup
- Properties:
- GroupDescription: Enable SSH access via port 22
- SecurityGroupIngress:
- - IpProtocol: tcp
- FromPort: '22'
- ToPort: '22'
- Outputs:
- InstanceId:
- Description: InstanceId of the newly created EC2 instance
- Value:
- Ref: EC2Instance
- AZ:
- Description: Availability Zone of the newly created EC2 instance
- Value:
- Fn::GetAtt:
- - EC2Instance
- - AvailabilityZone
- PublicDNS:
- Description: Public DNSName of the newly created EC2 instance
- Value:
- Fn::GetAtt:
- - EC2Instance
- - PublicDnsName
- PublicIP:
- Description: Public IP address of the newly created EC2 instance
- Value:
- Fn::GetAtt:
- - EC2Instance
- - PublicIp
Add Comment
Please, Sign In to add comment