This repository has been archived by the owner on Jun 5, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 217
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* To get an MVP of RDS working, we also need to create an DB Security Group to access it
- Loading branch information
Showing
20 changed files
with
466 additions
and
70 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 |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# RDS | ||
|
||
[Amazon Relational Database Service](http://aws.amazon.com/rds/) (Amazon RDS) is a web service that makes it easy to set up, operate, and scale a relational database in the cloud. | ||
|
||
## How | ||
|
||
This example creates a security group to allow Postgres RDS instance, then creates an RDS instance with that security group assigned. | ||
|
||
puppet apply rds_security.pp | ||
|
||
Unfortunatly, it's not possible to assign the EC2 group and the allowed IP's to the `db_securitygroup` through the API, so you have to do this manually though the console for now: | ||
|
||
## Add the Security Group We Made with Puppet** | ||
![Add EC2 Security Group](./images/add-rds-securitygroup.png?raw=true) | ||
|
||
## Add an IP to allow access to the RDS instance | ||
**Note: Enter `0.0.0.0/32` to allow all IPs** | ||
![Add IP to allow](./images/add-ip-to-allow.png?raw=true) | ||
|
||
## It should look something like this | ||
![Final Look](./images/final-screen.png?raw=true) | ||
|
||
You can now check your security group is correct by using Puppet resource commands: | ||
|
||
puppet resource rds_db_securitygroup rds-postgres-db_securitygroup | ||
|
||
It should return something like this: | ||
|
||
```puppet | ||
rds_db_securitygroup { 'rds-postgres-db_securitygroup': | ||
ensure => 'present', | ||
ec2_security_groups => [{'ec2_security_group_id' => 'sg-83fb3z5', 'ec2_security_group_name' => 'rds-postgres-group', 'ec2_security_group_owner_id' => '4822239859', 'status' => 'authorized'}], | ||
ip_ranges => [{'ip_range' => '0.0.0.0/32', 'status' => 'authorized'}], | ||
owner_id => '239838031', | ||
region => 'us-west-2', | ||
} | ||
``` | ||
When this is complete, create the RDS Postgres instance: | ||
|
||
puppet apply rds_postgres.pp | ||
|
||
This can take a while to setup, but when it's complete, you should be able to access it: | ||
|
||
```bash | ||
psql -d postgresql -h puppetlabs-aws-postgres.cwgutxb9fmx.us-west-2.rds.amazonaws.com -U root | ||
|
||
Password for user root: pullZstringz345 | ||
psql (9.4.0, server 9.3.5) | ||
SSL connection (protocol: TLSv1.2, cipher: DHE-RSA-AES256-GCM-SHA384, bits: 256, compression: off) | ||
Type "help" for help. | ||
|
||
postgresql=> exit | ||
``` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,15 @@ | ||
rds_instance { 'puppetlabs-aws-postgres': | ||
ensure => 'present', | ||
allocated_storage => '5', | ||
db_instance_class => 'db.m3.medium', | ||
db_name => 'postgresql', | ||
engine => 'postgres', | ||
license_model => 'postgresql-license', | ||
db_security_groups => 'rds-postgres-db_securitygroup', | ||
master_username => 'root', | ||
master_user_password=> 'pullZstringz345', | ||
multi_az => 'false', | ||
region => 'us-west-2', | ||
skip_final_snapshot => 'true', | ||
storage_type => 'gp2', | ||
} |
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,18 @@ | ||
ec2_securitygroup { 'rds-postgres-group': | ||
ensure => present, | ||
region => 'us-west-2', | ||
description => 'Group for Allowing access to Postgres (Port 5432)', | ||
ingress => [{ | ||
security_group => 'rds-postgres-group', | ||
},{ | ||
protocol => 'tcp', | ||
port => 5432, | ||
cidr => '0.0.0.0/0', | ||
}] | ||
} | ||
|
||
rds_db_securitygroup { 'rds-postgres-db_securitygroup': | ||
ensure => 'present', | ||
region => 'us-west-2', | ||
db_security_group_description => 'An RDS Security group to allow Postgres', | ||
} |
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
Oops, something went wrong.