38 lines
845 B
YAML
38 lines
845 B
YAML
AWSTemplateFormatVersion: 2010-09-09
|
|
Description: Building EC2 Instance using CloudFormation
|
|
|
|
Resources:
|
|
|
|
DefaultSecurityGroupIngress:
|
|
Type: 'AWS::EC2::SecurityGroupIngress'
|
|
Properties:
|
|
GroupId: sg-04979a7901ebe5c37
|
|
IpProtocol: tcp
|
|
FromPort: 22
|
|
ToPort: 22
|
|
CidrIp: 0.0.0.0/0
|
|
|
|
KeyPair:
|
|
Type: 'AWS::EC2::KeyPair::KeyName'
|
|
Properties:
|
|
KeyName: existing-key-pair-name
|
|
|
|
ChoseEC2:
|
|
Type: 'AWS::EC2::Instance'
|
|
DependsOn: KeyPair
|
|
Properties:
|
|
ImageId: ami-0df8c184d5f6ae949
|
|
InstanceType: t2.micro
|
|
KeyName: !Ref KeyPair
|
|
SecurityGroupIds:
|
|
- sg-04979a7901ebe5c37
|
|
|
|
Outputs:
|
|
LabInstanceId:
|
|
Description: Instance Id
|
|
Value: !Ref ChoseEC2
|
|
|
|
LabInstancePublicIP:
|
|
Description: Public IP address of the instance
|
|
Value: !GetAtt ChoseEC2.PublicIp
|