Skip to content

Instantly share code, notes, and snippets.

@siroken3
Created February 27, 2013 06:56
Show Gist options
  • Select an option

  • Save siroken3/5045806 to your computer and use it in GitHub Desktop.

Select an option

Save siroken3/5045806 to your computer and use it in GitHub Desktop.
botocoreのパラメータの渡し方、毎回探すのでメモ(BlockDeviceMapping.n.Ebs.SnapshotId なパラメータとか) see http://docs.aws.amazon.com/AWSEC2/latest/APIReference/ApiReference-query-RegisterImage.html
import botocore.session
session = botocore.session.get_session()
ec2 = session.get_service('ec2')
op = ec2.get_operation('RegisterImage')
ep = ec2.get_endpoint('us-east-1')
bd = [{"device_name":"/dev/sda", "ebs":{ "snapshot_id":"snap-XXXXXXX", "volume_size":10}}]
op.call(
ep,
name='NAME',
description='TEST',
architecture='x86_64',
kernel_id='aki-b4aa75dd',
root_device_name='/dev/sda1',
block_device_mappings=bd)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment