This allows a volume to be cloned from a snapshot, a brand new
volume to be created, or an ephemeral volumes to be associated
at time of instance creation.
This avoids any race conditions associated with creating extra volumes
after instance creation (e.g. writes happening before the volume is
mounted).
In addition, this allows the root volume to be edited
- a list of volume dicts, each containing device name and optionally ephemeral id or snapshot id. Size and type (and number of iops for io device type) must be specified for a new volume or a root volume, and may be passed for a snapshot volume. For any volume, a volume size less than 1 will be interpreted as a request not to create the volume.
required: false
default: null
aliases: []
requirements: [ "boto" ]
requirements: [ "boto" ]
author: Seth Vidal, Tim Gerla, Lester Wade
author: Seth Vidal, Tim Gerla, Lester Wade
@ -223,6 +230,23 @@ EXAMPLES = '''
instance_tags: '{"db":"postgres"}'
instance_tags: '{"db":"postgres"}'
monitoring=yes
monitoring=yes
# Single instance with additional IOPS volume from snapshot
local_action:
module: ec2
keypair: mykey
group: webserver
instance_type: m1.large
image: ami-6e649707
wait: yes
wait_timeout: 500
volumes:
- device_name: /dev/sdb
snapshot: snap-abcdef12
device_type: io1
iops: 1000
volume_size: 100
monitoring=yes
# Multiple groups example
# Multiple groups example
local_action:
local_action:
module: ec2
module: ec2
@ -236,6 +260,22 @@ local_action:
instance_tags: '{"db":"postgres"}'
instance_tags: '{"db":"postgres"}'
monitoring=yes
monitoring=yes
# Multiple instances with additional volume from snapshot
local_action:
module: ec2
keypair: mykey
group: webserver
instance_type: m1.large
image: ami-6e649707
wait: yes
wait_timeout: 500
count: 5
volumes:
- device_name: /dev/sdb
snapshot: snap-abcdef12
volume_size: 10
monitoring=yes
# VPC example
# VPC example
- local_action:
- local_action:
module: ec2
module: ec2
@ -296,6 +336,7 @@ import time
try:
try:
import boto.ec2
import boto.ec2
from boto.ec2.blockdevicemapping import BlockDeviceType, BlockDeviceMapping
from boto.exception import EC2ResponseError
from boto.exception import EC2ResponseError
except ImportError:
except ImportError:
print "failed=True msg='boto required for this module'"
print "failed=True msg='boto required for this module'"