小编ane*_*ari的帖子

RunInstances 操作:参数“iamInstanceProfile.name”不得与“iamInstanceProfile.arn”组合使用

这是我的代码。这段代码有问题吗?它显示一些错误!

import boto3
ec2 = boto3.resource('ec2', region_name = 'us-east-2')
instance = ec2.create_instances(
    BlockDeviceMappings=[
        {
            'DeviceName': '/dev/sdh',
            'VirtualName': 'ephemeral1',
            'Ebs': {
                'Encrypted': False,     
                'Iops': 500,
                'VolumeSize': 100,
                'VolumeType': 'io1'
            },
        },
    ],
    ImageId='ami-XXXXXXXXX',
    InstanceType='t2.micro',
    KeyName='KeyName',
    MaxCount=1,
    MinCount=1,
    IamInstanceProfile={
        'Arn': 'arn:aws:iam::000000000000:user/instance',
        'Name': 'instance'
    },
    InstanceInitiatedShutdownBehavior='stop',
    PrivateIpAddress='XXX.XX.XX.XX'
)
Run Code Online (Sandbox Code Playgroud)

它显示错误:

raise error_class(parsed_response, operation_name) botocore.exceptions.ClientError:调用 RunInstances 操作时发生错误 (InvalidParameterCombination):参数“iamInstanceProfile.name”不能与“iamInstanceProfile.arn”组合使用

python amazon-ec2 amazon-web-services boto3

3
推荐指数
1
解决办法
3637
查看次数

标签 统计

amazon-ec2 ×1

amazon-web-services ×1

boto3 ×1

python ×1