Created
February 20, 2023 04:18
-
-
Save BraveEvidence/0e054a4b5ad7ec8aea0d857abafb6f6d to your computer and use it in GitHub Desktop.
This file contains 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
--- | |
Parameters: | |
SecurityGroupDescription: | |
Description: Security Group Description | |
Type: String | |
Resources: | |
MyInstance: | |
Type: AWS::EC2::Instance | |
Properties: | |
AvailabilityZone: us-east-1a | |
ImageId: ami-a4c7edb2 | |
InstanceType: t2.micro | |
SecurityGroups: | |
- !Ref SSHSecurityGroup | |
- !Ref ServerSecurityGroup | |
# an elastic IP for our instance | |
MyEIP: | |
Type: AWS::EC2::EIP | |
Properties: | |
InstanceId: !Ref MyInstance | |
# our EC2 security group | |
SSHSecurityGroup: | |
Type: AWS::EC2::SecurityGroup | |
Properties: | |
GroupDescription: Enable SSH access via port 22 | |
SecurityGroupIngress: | |
- CidrIp: 0.0.0.0/0 | |
FromPort: 22 | |
IpProtocol: tcp | |
ToPort: 22 | |
# our second EC2 security group | |
ServerSecurityGroup: | |
Type: AWS::EC2::SecurityGroup | |
Properties: | |
GroupDescription: !Ref SecurityGroupDescription | |
SecurityGroupIngress: | |
- IpProtocol: tcp | |
FromPort: 80 | |
ToPort: 80 | |
CidrIp: 0.0.0.0/0 | |
- IpProtocol: tcp | |
FromPort: 22 | |
ToPort: 22 | |
CidrIp: 192.168.1.1/32 | |
Outputs: | |
ElasticIP: | |
Description: Elastic IP Value | |
Value: !Ref MyEIP |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment