Created
September 22, 2024 07:59
-
-
Save kencoba/83c005ba9a11890eb7ff9c54aa907a3f to your computer and use it in GitHub Desktop.
AWS CloudFormation template that create a Security Group.
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
AWSTemplateFormatVersion: '2010-09-09' | |
Description: CloudFormation template to create a Security Group allowing inbound traffic on port 3306 for MariaDB. | |
Parameters: | |
VpcId: | |
Type: AWS::EC2::VPC::Id | |
Description: VPC ID to create the security group in. | |
Prefix: | |
Type: String | |
Default: MyApp | |
Description: Prefix for all resource names | |
Resources: | |
MyMariaDBSecurityGroup: | |
Type: AWS::EC2::SecurityGroup | |
Properties: | |
GroupDescription: Security group for MariaDB allowing inbound traffic on port 3306 | |
VpcId: !Ref VpcId | |
SecurityGroupIngress: | |
- IpProtocol: tcp | |
FromPort: 3306 | |
ToPort: 3306 | |
CidrIp: 0.0.0.0/0 # Allows access from any IP (adjust as needed) | |
SecurityGroupEgress: | |
- IpProtocol: -1 # Allow all outbound traffic | |
FromPort: -1 | |
ToPort: -1 | |
CidrIp: 0.0.0.0/0 | |
Tags: | |
- Key: Name | |
Value: !Sub "${Prefix}-sg" | |
Outputs: | |
SecurityGroupId: | |
Description: The Security Group ID for MariaDB | |
Value: !Ref MyMariaDBSecurityGroup | |
Export: | |
Name: MariaDBSecurityGroupId |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment