Amazon Elastic Compute Cloud

2021/10/29 - Amazon Elastic Compute Cloud - 2 updated api methods

Changes  Support added for AMI sharing with organizations and organizational units in ModifyImageAttribute API

DescribeImageAttribute (updated) Link ¶
Changes (response)
{'LaunchPermissions': {'OrganizationArn': 'string',
                       'OrganizationalUnitArn': 'string'}}

Describes the specified attribute of the specified AMI. You can specify only one attribute at a time.

See also: AWS API Documentation

Request Syntax

client.describe_image_attribute(
    Attribute='description'|'kernel'|'ramdisk'|'launchPermission'|'productCodes'|'blockDeviceMapping'|'sriovNetSupport'|'bootMode',
    ImageId='string',
    DryRun=True|False
)
type Attribute

string

param Attribute

[REQUIRED]

The AMI attribute.

Note : The blockDeviceMapping attribute is deprecated. Using this attribute returns the Client.AuthFailure error. To get information about the block device mappings for an AMI, use the DescribeImages action.

type ImageId

string

param ImageId

[REQUIRED]

The ID of the AMI.

type DryRun

boolean

param DryRun

Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation .

rtype

dict

returns

Response Syntax

{
    'BlockDeviceMappings': [
        {
            'DeviceName': 'string',
            'VirtualName': 'string',
            'Ebs': {
                'DeleteOnTermination': True|False,
                'Iops': 123,
                'SnapshotId': 'string',
                'VolumeSize': 123,
                'VolumeType': 'standard'|'io1'|'io2'|'gp2'|'sc1'|'st1'|'gp3',
                'KmsKeyId': 'string',
                'Throughput': 123,
                'OutpostArn': 'string',
                'Encrypted': True|False
            },
            'NoDevice': 'string'
        },
    ],
    'ImageId': 'string',
    'LaunchPermissions': [
        {
            'Group': 'all',
            'UserId': 'string',
            'OrganizationArn': 'string',
            'OrganizationalUnitArn': 'string'
        },
    ],
    'ProductCodes': [
        {
            'ProductCodeId': 'string',
            'ProductCodeType': 'devpay'|'marketplace'
        },
    ],
    'Description': {
        'Value': 'string'
    },
    'KernelId': {
        'Value': 'string'
    },
    'RamdiskId': {
        'Value': 'string'
    },
    'SriovNetSupport': {
        'Value': 'string'
    },
    'BootMode': {
        'Value': 'string'
    }
}

Response Structure

  • (dict) --

    Describes an image attribute.

    • BlockDeviceMappings (list) --

      The block device mapping entries.

      • (dict) --

        Describes a block device mapping, which defines the EBS volumes and instance store volumes to attach to an instance at launch.

        • DeviceName (string) --

          The device name (for example, /dev/sdh or xvdh ).

        • VirtualName (string) --

          The virtual device name (ephemeral N). Instance store volumes are numbered starting from 0. An instance type with 2 available instance store volumes can specify mappings for ephemeral0 and ephemeral1 . The number of available instance store volumes depends on the instance type. After you connect to the instance, you must mount the volume.

          NVMe instance store volumes are automatically enumerated and assigned a device name. Including them in your block device mapping has no effect.

          Constraints: For M3 instances, you must specify instance store volumes in the block device mapping for the instance. When you launch an M3 instance, we ignore any instance store volumes specified in the block device mapping for the AMI.

        • Ebs (dict) --

          Parameters used to automatically set up EBS volumes when the instance is launched.

          • DeleteOnTermination (boolean) --

            Indicates whether the EBS volume is deleted on instance termination. For more information, see Preserving Amazon EBS volumes on instance termination in the Amazon EC2 User Guide .

          • Iops (integer) --

            The number of I/O operations per second (IOPS). For gp3 , io1 , and io2 volumes, this represents the number of IOPS that are provisioned for the volume. For gp2 volumes, this represents the baseline performance of the volume and the rate at which the volume accumulates I/O credits for bursting.

            The following are the supported values for each volume type:

            • gp3 : 3,000-16,000 IOPS

            • io1 : 100-64,000 IOPS

            • io2 : 100-64,000 IOPS

            For io1 and io2 volumes, we guarantee 64,000 IOPS only for Instances built on the Nitro System . Other instance families guarantee performance up to 32,000 IOPS.

            This parameter is required for io1 and io2 volumes. The default for gp3 volumes is 3,000 IOPS. This parameter is not supported for gp2 , st1 , sc1 , or standard volumes.

          • SnapshotId (string) --

            The ID of the snapshot.

          • VolumeSize (integer) --

            The size of the volume, in GiBs. You must specify either a snapshot ID or a volume size. If you specify a snapshot, the default is the snapshot size. You can specify a volume size that is equal to or larger than the snapshot size.

            The following are the supported volumes sizes for each volume type:

            • gp2 and gp3 :1-16,384

            • io1 and io2 : 4-16,384

            • st1 and sc1 : 125-16,384

            • standard : 1-1,024

          • VolumeType (string) --

            The volume type. For more information, see Amazon EBS volume types in the Amazon EC2 User Guide . If the volume type is io1 or io2 , you must specify the IOPS that the volume supports.

          • KmsKeyId (string) --

            Identifier (key ID, key alias, ID ARN, or alias ARN) for a customer managed CMK under which the EBS volume is encrypted.

            This parameter is only supported on BlockDeviceMapping objects called by RunInstances , RequestSpotFleet , and RequestSpotInstances .

          • Throughput (integer) --

            The throughput that the volume supports, in MiB/s.

            This parameter is valid only for gp3 volumes.

            Valid Range: Minimum value of 125. Maximum value of 1000.

          • OutpostArn (string) --

            The ARN of the Outpost on which the snapshot is stored.

          • Encrypted (boolean) --

            Indicates whether the encryption state of an EBS volume is changed while being restored from a backing snapshot. The effect of setting the encryption state to true depends on the volume origin (new or from a snapshot), starting encryption state, ownership, and whether encryption by default is enabled. For more information, see Amazon EBS encryption in the Amazon EC2 User Guide .

            In no case can you remove encryption from an encrypted volume.

            Encrypted volumes can only be attached to instances that support Amazon EBS encryption. For more information, see Supported instance types .

            This parameter is not returned by .

        • NoDevice (string) --

          To omit the device from the block device mapping, specify an empty string. When this property is specified, the device is removed from the block device mapping regardless of the assigned value.

    • ImageId (string) --

      The ID of the AMI.

    • LaunchPermissions (list) --

      The launch permissions.

      • (dict) --

        Describes a launch permission.

        • Group (string) --

          The name of the group.

        • UserId (string) --

          The Amazon Web Services account ID.

          Constraints: Up to 10 000 account IDs can be specified in a single request.

        • OrganizationArn (string) --

          The Amazon Resource Name (ARN) of an organization.

        • OrganizationalUnitArn (string) --

          The Amazon Resource Name (ARN) of an organizational unit (OU).

    • ProductCodes (list) --

      The product codes.

      • (dict) --

        Describes a product code.

        • ProductCodeId (string) --

          The product code.

        • ProductCodeType (string) --

          The type of product code.

    • Description (dict) --

      A description for the AMI.

      • Value (string) --

        The attribute value. The value is case-sensitive.

    • KernelId (dict) --

      The kernel ID.

      • Value (string) --

        The attribute value. The value is case-sensitive.

    • RamdiskId (dict) --

      The RAM disk ID.

      • Value (string) --

        The attribute value. The value is case-sensitive.

    • SriovNetSupport (dict) --

      Indicates whether enhanced networking with the Intel 82599 Virtual Function interface is enabled.

      • Value (string) --

        The attribute value. The value is case-sensitive.

    • BootMode (dict) --

      Describes a value for a resource attribute that is a String.

      • Value (string) --

        The attribute value. The value is case-sensitive.

ModifyImageAttribute (updated) Link ¶
Changes (request)
{'LaunchPermission': {'Add': {'OrganizationArn': 'string',
                              'OrganizationalUnitArn': 'string'},
                      'Remove': {'OrganizationArn': 'string',
                                 'OrganizationalUnitArn': 'string'}},
 'OrganizationArns': ['string'],
 'OrganizationalUnitArns': ['string']}

Modifies the specified attribute of the specified AMI. You can specify only one attribute at a time. You can use the Attribute parameter to specify the attribute or one of the following parameters: Description or LaunchPermission .

Images with an Amazon Web Services Marketplace product code cannot be made public.

To enable the SriovNetSupport enhanced networking attribute of an image, enable SriovNetSupport on an instance and create an AMI from the instance.

See also: AWS API Documentation

Request Syntax

client.modify_image_attribute(
    Attribute='string',
    Description={
        'Value': 'string'
    },
    ImageId='string',
    LaunchPermission={
        'Add': [
            {
                'Group': 'all',
                'UserId': 'string',
                'OrganizationArn': 'string',
                'OrganizationalUnitArn': 'string'
            },
        ],
        'Remove': [
            {
                'Group': 'all',
                'UserId': 'string',
                'OrganizationArn': 'string',
                'OrganizationalUnitArn': 'string'
            },
        ]
    },
    OperationType='add'|'remove',
    ProductCodes=[
        'string',
    ],
    UserGroups=[
        'string',
    ],
    UserIds=[
        'string',
    ],
    Value='string',
    DryRun=True|False,
    OrganizationArns=[
        'string',
    ],
    OrganizationalUnitArns=[
        'string',
    ]
)
type Attribute

string

param Attribute

The name of the attribute to modify.

Valid values: description | launchPermission

type Description

dict

param Description

A new description for the AMI.

  • Value (string) --

    The attribute value. The value is case-sensitive.

type ImageId

string

param ImageId

[REQUIRED]

The ID of the AMI.

type LaunchPermission

dict

param LaunchPermission

A new launch permission for the AMI.

  • Add (list) --

    The Amazon Web Services account ID to add to the list of launch permissions for the AMI.

    • (dict) --

      Describes a launch permission.

      • Group (string) --

        The name of the group.

      • UserId (string) --

        The Amazon Web Services account ID.

        Constraints: Up to 10 000 account IDs can be specified in a single request.

      • OrganizationArn (string) --

        The Amazon Resource Name (ARN) of an organization.

      • OrganizationalUnitArn (string) --

        The Amazon Resource Name (ARN) of an organizational unit (OU).

  • Remove (list) --

    The Amazon Web Services account ID to remove from the list of launch permissions for the AMI.

    • (dict) --

      Describes a launch permission.

      • Group (string) --

        The name of the group.

      • UserId (string) --

        The Amazon Web Services account ID.

        Constraints: Up to 10 000 account IDs can be specified in a single request.

      • OrganizationArn (string) --

        The Amazon Resource Name (ARN) of an organization.

      • OrganizationalUnitArn (string) --

        The Amazon Resource Name (ARN) of an organizational unit (OU).

type OperationType

string

param OperationType

The operation type. This parameter can be used only when the Attribute parameter is launchPermission .

type ProductCodes

list

param ProductCodes

Not supported.

  • (string) --

type UserGroups

list

param UserGroups

The user groups. This parameter can be used only when the Attribute parameter is launchPermission .

  • (string) --

type UserIds

list

param UserIds

The Amazon Web Services account IDs. This parameter can be used only when the Attribute parameter is launchPermission .

  • (string) --

type Value

string

param Value

The value of the attribute being modified. This parameter can be used only when the Attribute parameter is description .

type DryRun

boolean

param DryRun

Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation . Otherwise, it is UnauthorizedOperation .

type OrganizationArns

list

param OrganizationArns

The Amazon Resource Name (ARN) of an organization. This parameter can be used only when the Attribute parameter is launchPermission .

  • (string) --

type OrganizationalUnitArns

list

param OrganizationalUnitArns

The Amazon Resource Name (ARN) of an organizational unit (OU). This parameter can be used only when the Attribute parameter is launchPermission .

  • (string) --

returns

None