-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/cmatKhan/yeastregulatorydb
wq
- Loading branch information
Showing
10 changed files
with
162 additions
and
8 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,4 @@ | |
venv | ||
.git | ||
.envs/ | ||
rds_redis_ec2_config.yml |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,153 @@ | ||
AWSTemplateFormatVersion: '2010-09-09' | ||
Description: CloudFormation template for PostgreSQL RDS, Redis ElastiCache, and Ubuntu EC2 instance. | ||
|
||
Resources: | ||
MyCustomParameterGroup: | ||
Type: AWS::RDS::DBParameterGroup | ||
Properties: | ||
Description: Custom parameter group for my DB | ||
Family: postgres13 # Adjust based on your PostgreSQL version | ||
Parameters: | ||
max_connections: "200" # Example: Increase max connections | ||
|
||
MyDBInstance: | ||
Type: AWS::RDS::DBInstance | ||
DependsOn: | ||
- MyDBSecurityGroup | ||
Properties: | ||
DBName: mydatabase | ||
AllocatedStorage: 20 | ||
DBInstanceClass: db.t3.micro | ||
Engine: postgres | ||
MasterUsername: postgres | ||
MasterUserPassword: Jex19UIFCmM2u6ZhRKZd | ||
BackupRetentionPeriod: 3 | ||
VPCSecurityGroups: | ||
- !Ref MyDBSecurityGroup | ||
DBParameterGroupName: !Ref MyCustomParameterGroup # Associate the custom parameter group | ||
|
||
MyDBProxy: | ||
Type: AWS::RDS::DBProxy | ||
Properties: | ||
DBProxyName: mydbproxy | ||
EngineFamily: POSTGRESQL | ||
Auth: | ||
- AuthScheme: SECRETS | ||
IAMAuth: DISABLED | ||
SecretArn: !GetAtt MyDBSecret.Arn | ||
RoleArn: !GetAtt MyDBProxyRole.Arn | ||
VpcSecurityGroupIds: | ||
- !Ref MyDBSecurityGroup | ||
VpcSubnetIds: | ||
- !Ref MySubnet1 | ||
- !Ref MySubnet2 | ||
RequireTLS: false | ||
|
||
MyDBProxyRole: | ||
Type: AWS::IAM::Role | ||
Properties: | ||
AssumeRolePolicyDocument: | ||
Version: '2012-10-17' | ||
Statement: | ||
- Effect: Allow | ||
Principal: | ||
Service: rds.amazonaws.com | ||
Action: sts:AssumeRole | ||
Policies: | ||
- PolicyName: RDSProxyPolicy | ||
PolicyDocument: | ||
Version: '2012-10-17' | ||
Statement: | ||
- Effect: Allow | ||
Action: | ||
- secretsmanager:GetSecretValue | ||
- secretsmanager:DescribeSecret | ||
Resource: '*' | ||
|
||
MyDBSecret: | ||
Type: AWS::SecretsManager::Secret | ||
Properties: | ||
Name: MyDBSecret | ||
Description: "RDS database credentials" | ||
SecretString: !Sub '{"username":"${MyDBInstance.MasterUsername}","password":"Jex19UIFCmM2u6ZhRKZd","engine":"postgres","host":"${MyDBInstance.Endpoint.Address}","port":"5432","dbClusterIdentifier":"${MyDBInstance.DBInstanceIdentifier}"}' | ||
|
||
|
||
MyElastiCacheRedis: | ||
Type: AWS::ElastiCache::CacheCluster | ||
DependsOn: | ||
- MyCacheSecurityGroup | ||
Properties: | ||
CacheNodeType: cache.t2.micro | ||
Engine: redis | ||
NumCacheNodes: 1 | ||
VpcSecurityGroupIds: | ||
- !Ref MyCacheSecurityGroup | ||
|
||
MyEC2Instance: | ||
Type: AWS::EC2::Instance | ||
DependsOn: | ||
- MyInstanceSecurityGroup | ||
Properties: | ||
ImageId: ami-05fb0b8c1424f266b | ||
InstanceType: t2.micro | ||
SecurityGroupIds: | ||
- !GetAtt MyInstanceSecurityGroup.GroupId | ||
KeyName: general_strides | ||
|
||
MyDBSecurityGroup: | ||
Type: AWS::EC2::SecurityGroup | ||
DependsOn: | ||
- MyInstanceSecurityGroup | ||
Properties: | ||
GroupDescription: Allow access to PostgreSQL | ||
VpcId: vpc-0e2c306eb7a371817 | ||
SecurityGroupIngress: | ||
- IpProtocol: tcp | ||
FromPort: 5432 | ||
ToPort: 5432 | ||
SourceSecurityGroupId: !Ref MyInstanceSecurityGroup | ||
|
||
MyCacheSecurityGroup: | ||
Type: AWS::EC2::SecurityGroup | ||
DependsOn: MyInstanceSecurityGroup | ||
Properties: | ||
GroupDescription: Allow access to Redis | ||
VpcId: vpc-0e2c306eb7a371817 | ||
SecurityGroupIngress: | ||
- IpProtocol: tcp | ||
FromPort: 6379 | ||
ToPort: 6379 | ||
SourceSecurityGroupId: !Ref MyInstanceSecurityGroup | ||
|
||
MyInstanceSecurityGroup: | ||
Type: AWS::EC2::SecurityGroup | ||
Properties: | ||
GroupDescription: Security group for EC2 instance | ||
VpcId: vpc-0e2c306eb7a371817 | ||
SecurityGroupIngress: | ||
- IpProtocol: tcp | ||
FromPort: 22 | ||
ToPort: 22 | ||
CidrIp: 107.200.64.20/32 | ||
- IpProtocol: tcp | ||
FromPort: 80 | ||
ToPort: 80 | ||
CidrIp: 0.0.0.0/0 | ||
|
||
Outputs: | ||
RDSInstanceEndpoint: | ||
Description: Endpoint of the RDS instance | ||
Value: !GetAtt MyDBInstance.Endpoint.Address | ||
|
||
RDSProxyEndpoint: | ||
Description: Endpoint of the RDS Proxy | ||
Value: !GetAtt MyDBProxy.Endpoint | ||
|
||
RedisEndpoint: | ||
Description: Endpoint of the Redis ElastiCache instance | ||
Value: !GetAtt MyElastiCacheRedis.RedisEndpoint.Address | ||
|
||
EC2InstancePublicIP: | ||
Description: Public IP of the EC2 instance | ||
Value: !GetAtt MyEC2Instance.PublicIp | ||
|
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
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
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
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
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
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
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
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