Note: Some versions of Boto3 accept either Arn
or Name
, but all versions accept Name
. I suggest using only the role name.
IamInstanceProfile={ 'Arn': 'string', 'Name': 'string' }
If your profile name is ExampleInstanceProfile
and ARN is arn:aws:iam::123456789012:instance-profile/ExampleInstanceProfile
ec2.create_instances(ImageId='ami-1e299d7e', InstanceType='t2.micro', MinCount=1, MaxCount=1, SecurityGroupIds=['Mysecuritygroup'], KeyName='mykeyname', IamInstanceProfile={ 'Arn': 'arn:aws:iam::123456789012:instanceprofile/ExampleInstanceProfile' 'Name': 'ExampleInstanceProfile' })
source share