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
OpenEdx
configuration
Commits
9d9eca24
Commit
9d9eca24
authored
Aug 27, 2013
by
Feanil Patel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Be able to generate ssh config rules given a cloudformation stack name.
parent
84661512
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
2 deletions
+15
-2
util/vpc-tools/vpc-tools.py
+15
-2
No files found.
util/vpc-tools/vpc-tools.py
View file @
9d9eca24
"""VPC Tools.
Usage:
vpc-tools.py ssh-config
vpc <vpc_id>
identity-file <identity_file> user <user> [config-file <config_file>] [strict-host-check <strict_host_check>]
vpc-tools.py ssh-config
(vpc <vpc_id> | stack-name <stack_name>)
identity-file <identity_file> user <user> [config-file <config_file>] [strict-host-check <strict_host_check>]
vpc-tools.py (-h --help)
vpc-tools.py (-v --version)
...
...
@@ -43,13 +43,26 @@ def dispatch(args):
if
args
.
get
(
"ssh-config"
):
_ssh_config
(
args
)
def
vpc_for_stack_name
(
stack_name
):
cfn
=
boto
.
connect_cloudformation
()
resources
=
cfn
.
list_stack_resources
(
stack_name
)
for
resource
in
resources
:
if
resource
.
resource_type
==
'AWS::EC2::VPC'
:
return
resource
.
physical_resource_id
def
_ssh_config
(
args
):
if
args
.
get
(
"vpc"
):
vpc_id
=
args
.
get
(
"<vpc_id>"
)
elif
args
.
get
(
"stack-name"
):
stack_name
=
args
.
get
(
"<stack_name>"
)
vpc_id
=
vpc_for_stack_name
(
stack_name
)
else
:
raise
Exception
(
"No way to know which vpc to query."
)
vpc
=
boto
.
connect_vpc
()
identity_file
=
args
.
get
(
"<identity_file>"
)
user
=
args
.
get
(
"<user>"
)
vpc_id
=
args
.
get
(
"<vpc_id>"
)
config_file
=
args
.
get
(
"<config_file>"
)
strict_host_check
=
args
.
get
(
"<strict_host_check>"
)
...
...
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