Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
configuration
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
configuration
Commits
a87329ad
Commit
a87329ad
authored
May 16, 2014
by
John Jarvis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
option to create non-vpc rds clone
parent
529d374b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
5 deletions
+12
-5
util/vpc-tools/db-clone.py
+12
-5
No files found.
util/vpc-tools/db-clone.py
View file @
a87329ad
...
...
@@ -13,12 +13,15 @@ import os
description
=
"""
Creates a new RDS instance
in a VPC
using restore
Creates a new RDS instance using restore
from point in time using the latest available backup.
The new db will be the same size as the original.
The name of the db will remain the same, the master db password
will be changed and is set on the command line.
If stack-name is provided the RDS instance will be launched
in the VPC that corresponds to that name.
New db name defaults to "from-<source db name>-<human date>-<ts>"
A new DNS entry will be created for the RDS when provided
on the command line
...
...
@@ -61,7 +64,8 @@ def parse_args(args=sys.argv[1:]):
parser
=
ArgumentParser
(
description
=
description
,
formatter_class
=
RawTextHelpFormatter
)
parser
.
add_argument
(
'-s'
,
'--stack-name'
,
choices
=
stack_names
,
default
=
'stage-edx'
,
default
=
'stage-edx'
,
required
=
False
,
default
=
None
,
help
=
'Stack name for where you want this RDS instance launched'
)
parser
.
add_argument
(
'-t'
,
'--type'
,
choices
=
RDS_SIZES
,
default
=
'db.m1.small'
,
help
=
'RDS size to create instances of'
)
...
...
@@ -111,14 +115,17 @@ if __name__ == '__main__':
play_path
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
)),
"../../playbooks/edx-east"
)
rds
=
boto
.
rds2
.
connect_to_region
(
args
.
region
)
subnet_name
=
rds_subnet_group_name_for_stack_name
(
args
.
stack_name
)
restore_dbid
=
'from-{0}-{1}-{2}'
.
format
(
args
.
db_source
,
datetime
.
date
.
today
(),
int
(
time
.
time
()))
r
ds
.
restore_db_instance_to_point_in_time
(
r
estore_args
=
dict
(
source_db_instance_identifier
=
args
.
db_source
,
target_db_instance_identifier
=
restore_dbid
,
use_latest_restorable_time
=
True
,
db_instance_class
=
args
.
type
,
db_subnet_group_name
=
subnet_name
)
)
if
args
.
stack_name
:
subnet_name
=
rds_subnet_group_name_for_stack_name
(
args
.
stack_name
)
restore_args
[
'db_subnet_group_name'
]
=
subnet_name
rds
.
restore_db_instance_to_point_in_time
(
**
restore_args
)
wait_on_db_status
(
restore_dbid
)
db_host
=
rds
.
describe_db_instances
(
restore_dbid
)[
'DescribeDBInstancesResponse'
][
'DescribeDBInstancesResult'
][
'DBInstances'
][
0
][
'Endpoint'
][
'Address'
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment