-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate-ec2.yml
More file actions
29 lines (27 loc) · 767 Bytes
/
Copy pathcreate-ec2.yml
File metadata and controls
29 lines (27 loc) · 767 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
AWSTemplateFormatVersion: '2010-09-09'
Description: Template to create an EC2 instance
Resources:
MyEC2Instance:
Type: 'AWS::EC2::Instance'
Properties:
InstanceType: t2.micro
KeyName: 'your-key-pair'
ImageId: 'ami-0c55b159cbfafe1f0' # Update with a valid AMI ID
SecurityGroupIds:
- !Ref InstanceSecurityGroup
Tags:
- Key: Name
Value: MyEC2Instance
InstanceSecurityGroup:
Type: 'AWS::EC2::SecurityGroup'
Properties:
GroupDescription: Allow SSH and HTTP access
SecurityGroupIngress:
- IpProtocol: tcp
FromPort: 22
ToPort: 22
CidrIp: 0.0.0.0/0
- IpProtocol: tcp
FromPort: 80
ToPort: 80
CidrIp: 0.0.0.0/0