Skip to content

Commit 7a44c26

Browse files
committed
Merge pull request #86 from remind101/rds_v2
Initial attempt at new RDS blueprint framework
2 parents 908f5a9 + 47a0dd4 commit 7a44c26

File tree

10 files changed

+723
-2
lines changed

10 files changed

+723
-2
lines changed

conf/rds/README.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
=====================
2+
Example RDS v2 Stacks
3+
=====================
4+
5+
This directory contains configs for testing out version 2 of the RDS stack
6+
framework.

conf/rds/mysql.env

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# VPC settings
2+
azcount: 2
3+
nat_instance_type: m3.medium
4+
ssh_key_name: default
5+
6+
# DB settings
7+
db_instance_type: db.m3.large
8+
storage_size: 100
9+
iops: 1000
10+
db_family: mysql5.6
11+
engine_version: 5.6.23
12+
engine_major_version: 5.6
13+
storage_encrypted: '"true"'
14+
15+
# Master only settings
16+
master_name: mysql-master
17+
db_user: myuser
18+
db_passwd: SECRETPASSWORD
19+
db_name: mydb
20+
master_storage_encrypted: '"true"'
21+
22+
# Slave only settings
23+
slave_name: mysql-slave
24+
slave_storage_encrypted: '"true"'

conf/rds/mysql.yaml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# Hooks require a path.
2+
# If the build should stop when a hook fails, set required to true.
3+
# pre_build happens before the build
4+
# post_build happens after the build
5+
#pre_build:
6+
# - path: stacker.hooks.route53.create_domain
7+
# required: true
8+
# Additional args can be passed as a dict of key/value pairs in kwargs
9+
# kwargs:
10+
# post_build:
11+
12+
mappings:
13+
AmiMap:
14+
us-east-1:
15+
NAT: ami-ad227cc4
16+
ubuntu1404: ami-74e27e1c
17+
bastion: ami-74e27e1c
18+
us-west-2:
19+
NAT: ami-290f4119
20+
ubuntu1404: ami-5189a661
21+
bastion: ami-5189a661
22+
23+
vpc_parameters: &vpc_parameters
24+
VpcId: vpc::VpcId # parametrs with ::'s in them refer to <stack>::<Output>
25+
DefaultSG: vpc::DefaultSG
26+
PublicSubnets: vpc::PublicSubnets
27+
PrivateSubnets: vpc::PrivateSubnets
28+
AvailabilityZones: vpc::AvailabilityZones
29+
30+
stacks:
31+
- name: vpc
32+
class_path: stacker.blueprints.vpc.VPC
33+
parameters:
34+
# AZCount is the # of AvailabilityZones to attempt to build in. You
35+
# should build in as many as you can afford in order to provide for
36+
# better fault tolerance. Note: Since this is all done in a VPC, you
37+
# need to find out how many AZs can handle VPC subnets for the
38+
# region you are building in. As of this writing, here are the max
39+
# allowed AZCount's for each zone:
40+
# us-east-1: 4, us-west-1: 2, us-west-2: 3, eu-west-1: 3
41+
# Note: The minimum allowed AZCount is 2.
42+
AZCount: ${azcount}
43+
# Enough subnets for 4 AZs
44+
PublicSubnets: 10.128.0.0/24,10.128.1.0/24,10.128.2.0/24,10.128.3.0/24
45+
PrivateSubnets: 10.128.8.0/22,10.128.12.0/22,10.128.16.0/22,10.128.20.0/22
46+
# InstanceType used for NAT instances
47+
InstanceType: ${nat_instance_type}
48+
SshKeyName: ${ssh_key_name}
49+
InternalDomain: internal
50+
# CidrBlock needs to be hold all of the Public & Private subnets above
51+
CidrBlock: 10.128.0.0/16
52+
ImageName: NAT
53+
- name: mysqlMaster
54+
class_path: stacker.blueprints.rds.mysql.MasterInstance
55+
parameters:
56+
<< : *vpc_parameters
57+
Subnets: vpc::PrivateSubnets
58+
InstanceType: ${db_instance_type}
59+
AllowMajorVersionUpgrade: "false"
60+
AutoMinorVersionUpgrade: "true"
61+
AllocatedStorage: ${storage_size}
62+
IOPS: ${iops}
63+
InternalZoneName: vpc::InternalZoneName
64+
InternalZoneId: vpc::InternalZoneId
65+
InternalHostname: ${master_name}
66+
DBInstanceIdentifier: ${master_name}
67+
DBFamily: ${db_family}
68+
EngineVersion: ${engine_version}
69+
EngineMajorVersion: ${engine_major_version}
70+
StorageEncrypted: ${master_storage_encrypted}
71+
# MasterInstance specific
72+
MasterUser: ${db_user}
73+
MasterUserPassword: ${db_passwd}
74+
DatabaseName: ${db_name}
75+
MultiAZ: "true"
76+
- name: mysqlSlave
77+
class_path: stacker.blueprints.rds.mysql.ReadReplica
78+
parameters:
79+
<< : *vpc_parameters
80+
Subnets: vpc::PrivateSubnets
81+
InstanceType: ${db_instance_type}
82+
AllowMajorVersionUpgrade: "false"
83+
AutoMinorVersionUpgrade: "true"
84+
AllocatedStorage: ${storage_size}
85+
IOPS: ${iops}
86+
InternalZoneName: vpc::InternalZoneName
87+
InternalZoneId: vpc::InternalZoneId
88+
InternalHostname: ${slave_name}
89+
DBInstanceIdentifier: ${slave_name}
90+
DBFamily: ${db_family}
91+
EngineVersion: ${engine_version}
92+
EngineMajorVersion: ${engine_major_version}
93+
StorageEncrypted: ${slave_storage_encrypted}
94+
# ReadReplica Specific
95+
MasterDatabaseId: mysqlMaster::DBInstance

conf/rds/postgres.env

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# VPC settings
2+
azcount: 2
3+
nat_instance_type: m3.medium
4+
ssh_key_name: default
5+
6+
# DB settings
7+
db_instance_type: db.m3.large
8+
storage_size: 100
9+
iops: 1000
10+
db_family: postgres9.4
11+
engine_version: 9.4.1
12+
engine_major_version: 9.4
13+
storage_encrypted: '"true"'
14+
15+
# Master only settings
16+
master_name: postgres-master
17+
db_user: myuser
18+
db_passwd: SECRETPASSWORD
19+
db_name: mydb
20+
master_storage_encrypted: '"true"'
21+
22+
# Slave only settings
23+
slave_name: postgres-slave
24+
slave_storage_encrypted: '"true"'

conf/rds/postgres.yaml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# Hooks require a path.
2+
# If the build should stop when a hook fails, set required to true.
3+
# pre_build happens before the build
4+
# post_build happens after the build
5+
#pre_build:
6+
# - path: stacker.hooks.route53.create_domain
7+
# required: true
8+
# Additional args can be passed as a dict of key/value pairs in kwargs
9+
# kwargs:
10+
# post_build:
11+
12+
mappings:
13+
AmiMap:
14+
us-east-1:
15+
NAT: ami-ad227cc4
16+
ubuntu1404: ami-74e27e1c
17+
bastion: ami-74e27e1c
18+
us-west-2:
19+
NAT: ami-290f4119
20+
ubuntu1404: ami-5189a661
21+
bastion: ami-5189a661
22+
23+
vpc_parameters: &vpc_parameters
24+
VpcId: vpc::VpcId # parametrs with ::'s in them refer to <stack>::<Output>
25+
DefaultSG: vpc::DefaultSG
26+
PublicSubnets: vpc::PublicSubnets
27+
PrivateSubnets: vpc::PrivateSubnets
28+
AvailabilityZones: vpc::AvailabilityZones
29+
30+
stacks:
31+
- name: vpc
32+
class_path: stacker.blueprints.vpc.VPC
33+
parameters:
34+
# AZCount is the # of AvailabilityZones to attempt to build in. You
35+
# should build in as many as you can afford in order to provide for
36+
# better fault tolerance. Note: Since this is all done in a VPC, you
37+
# need to find out how many AZs can handle VPC subnets for the
38+
# region you are building in. As of this writing, here are the max
39+
# allowed AZCount's for each zone:
40+
# us-east-1: 4, us-west-1: 2, us-west-2: 3, eu-west-1: 3
41+
# Note: The minimum allowed AZCount is 2.
42+
AZCount: ${azcount}
43+
# Enough subnets for 4 AZs
44+
PublicSubnets: 10.128.0.0/24,10.128.1.0/24,10.128.2.0/24,10.128.3.0/24
45+
PrivateSubnets: 10.128.8.0/22,10.128.12.0/22,10.128.16.0/22,10.128.20.0/22
46+
# InstanceType used for NAT instances
47+
InstanceType: ${nat_instance_type}
48+
SshKeyName: ${ssh_key_name}
49+
InternalDomain: internal
50+
# CidrBlock needs to be hold all of the Public & Private subnets above
51+
CidrBlock: 10.128.0.0/16
52+
ImageName: NAT
53+
- name: postgresMaster
54+
class_path: stacker.blueprints.rds.postgres.MasterInstance
55+
parameters:
56+
<< : *vpc_parameters
57+
Subnets: vpc::PrivateSubnets
58+
InstanceType: ${db_instance_type}
59+
AllowMajorVersionUpgrade: "false"
60+
AutoMinorVersionUpgrade: "true"
61+
AllocatedStorage: ${storage_size}
62+
IOPS: ${iops}
63+
InternalZoneName: vpc::InternalZoneName
64+
InternalZoneId: vpc::InternalZoneId
65+
InternalHostname: ${master_name}
66+
DBInstanceIdentifier: ${master_name}
67+
DBFamily: ${db_family}
68+
EngineVersion: ${engine_version}
69+
EngineMajorVersion: ${engine_major_version}
70+
StorageEncrypted: ${master_storage_encrypted}
71+
# MasterInstance specific
72+
MasterUser: ${db_user}
73+
MasterUserPassword: ${db_passwd}
74+
DatabaseName: ${db_name}
75+
MultiAZ: "true"
76+
- name: postgresSlave
77+
class_path: stacker.blueprints.rds.postgres.ReadReplica
78+
parameters:
79+
<< : *vpc_parameters
80+
Subnets: vpc::PrivateSubnets
81+
InstanceType: ${db_instance_type}
82+
AllowMajorVersionUpgrade: "false"
83+
AutoMinorVersionUpgrade: "true"
84+
AllocatedStorage: ${storage_size}
85+
IOPS: ${iops}
86+
InternalZoneName: vpc::InternalZoneName
87+
InternalZoneId: vpc::InternalZoneId
88+
InternalHostname: ${slave_name}
89+
DBInstanceIdentifier: ${slave_name}
90+
DBFamily: ${db_family}
91+
EngineVersion: ${engine_version}
92+
EngineMajorVersion: ${engine_major_version}
93+
StorageEncrypted: ${slave_storage_encrypted}
94+
# ReadReplica Specific
95+
MasterDatabaseId: postgresMaster::DBInstance

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
src_dir = os.path.dirname(__file__)
66

77
install_requires = [
8-
'troposphere>=1.0.0',
8+
'troposphere>=1.2.1',
99
'boto>=2.25.0',
1010
'PyYAML>=3.11',
11-
'awacs>=0.5.2',
11+
'awacs>=0.5.3',
1212
]
1313

1414
tests_require = [

stacker/blueprints/rds/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)