From 27abceefc13e2d0facc9107a74699da95a5af1ba Mon Sep 17 00:00:00 2001 From: Marcin Kulisz Date: Wed, 21 Sep 2016 14:26:47 +0100 Subject: [PATCH] Plugin: ec2_launch ssh key, instance type, etc. + * added ssh_key parameter to the manifest to connect with (have to be present in AWS) * added readme * changed instance type to something what can run outside VPC (m3.medium) --- bootstrapvz/plugins/ec2_launch/README.rst | 22 +++++++++++++++++++ .../plugins/ec2_launch/manifest-schema.yml | 1 + bootstrapvz/plugins/ec2_launch/tasks.py | 4 +++- 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 bootstrapvz/plugins/ec2_launch/README.rst diff --git a/bootstrapvz/plugins/ec2_launch/README.rst b/bootstrapvz/plugins/ec2_launch/README.rst new file mode 100644 index 0000000..a7ed014 --- /dev/null +++ b/bootstrapvz/plugins/ec2_launch/README.rst @@ -0,0 +1,22 @@ +ec2-launch +---------- +This plugin is spinning up **AWS classic instance** from the AMI created with +the template from which this plugin is invoked. + +Settings +~~~~~~~~ +- ``security_group_ids``: A list of security groups (not VPC) to attach to the + instance + ``required`` +- ``instance_type``: A string with AWS Classic capable instance to run + (default: m3.medium) + ``optional`` +- ``ssh_key``: A string with the ssh key name to apply to the instance. + ``required`` +- ``print_public_ip``: A string with the path to write instance external IP to + ``optional`` +- ``tags``: + ``optional`` +- ``deregister_ami``: A boolean value describing if AMI should be kept after + sinning up instance or not (default: false) + ``optional`` diff --git a/bootstrapvz/plugins/ec2_launch/manifest-schema.yml b/bootstrapvz/plugins/ec2_launch/manifest-schema.yml index 9d7992e..e057162 100644 --- a/bootstrapvz/plugins/ec2_launch/manifest-schema.yml +++ b/bootstrapvz/plugins/ec2_launch/manifest-schema.yml @@ -14,6 +14,7 @@ properties: items: {type: string} uniqueItems: true instance_type: {type: string} + ssh_key: {type: string} print_public_ip: {type: string} tags: {type: object} deregister_ami: {type: boolean} diff --git a/bootstrapvz/plugins/ec2_launch/tasks.py b/bootstrapvz/plugins/ec2_launch/tasks.py index b64d4c3..b0c5add 100644 --- a/bootstrapvz/plugins/ec2_launch/tasks.py +++ b/bootstrapvz/plugins/ec2_launch/tasks.py @@ -25,7 +25,9 @@ class LaunchEC2Instance(Task): conn = info._ec2['connection'] r = conn.run_instances(info._ec2['image'], security_group_ids=info.manifest.plugins['ec2_launch'].get('security_group_ids'), - instance_type=info.manifest.plugins['ec2_launch'].get('instance_type', 't2.micro')) + key_name=info.manifest.plugins['ec2_launch'].get('ssh_key'), + instance_type=info.manifest.plugins['ec2_launch'].get('instance_type', + 'm3.medium')) info._ec2['instance'] = r.instances[0] if 'tags' in info.manifest.plugins['ec2_launch']: