I cannot figure out from documentation and source code how to define size of the root device.
You can specify N additional block devices using BlockDeviceMappings sectio
Follow is minimal required fields that have to be set the size of the root device:
import boto3
ec2_resource = boto3.resource('ec2')
reservations = ec2_resource.create_instances(
ImageId= "ami-xyz",
MinCount=1,
MaxCount=1,
InstanceType='xyz',
KeyName='key-pair',
TagSpecifications=[
{
'ResourceType': 'instance',
'Tags': [{
'Key': 'Name',
'Value': 'xyz-machine'
}]
}
],
IamInstanceProfile={
'Name':'xyz-role'
},
BlockDeviceMappings=[
{
'DeviceName': '/dev/sda1',
'Ebs': {
'VolumeSize': 30,
'VolumeType': 'standard'
}
}
]
)