EC2 / Client / copy_volumes

copy_volumes

EC2.Client.copy_volumes(**kwargs)

Creates a crash-consistent, point-in-time copy of an existing Amazon EBS volume within the same Availability Zone. The volume copy can be attached to an Amazon EC2 instance once it reaches the available state. For more information, see Copy an Amazon EBS volume.

See also: AWS API Documentation

Request Syntax

response = client.copy_volumes(
    SourceVolumeId='string',
    Iops=123,
    Size=123,
    VolumeType='standard'|'io1'|'io2'|'gp2'|'sc1'|'st1'|'gp3',
    DryRun=True|False,
    TagSpecifications=[
        {
            'ResourceType': 'capacity-reservation'|'client-vpn-endpoint'|'customer-gateway'|'carrier-gateway'|'coip-pool'|'declarative-policies-report'|'dedicated-host'|'dhcp-options'|'egress-only-internet-gateway'|'elastic-ip'|'elastic-gpu'|'export-image-task'|'export-instance-task'|'fleet'|'fpga-image'|'host-reservation'|'image'|'image-usage-report'|'import-image-task'|'import-snapshot-task'|'instance'|'instance-event-window'|'internet-gateway'|'ipam'|'ipam-pool'|'ipam-scope'|'ipv4pool-ec2'|'ipv6pool-ec2'|'key-pair'|'launch-template'|'local-gateway'|'local-gateway-route-table'|'local-gateway-virtual-interface'|'local-gateway-virtual-interface-group'|'local-gateway-route-table-vpc-association'|'local-gateway-route-table-virtual-interface-group-association'|'natgateway'|'network-acl'|'network-interface'|'network-insights-analysis'|'network-insights-path'|'network-insights-access-scope'|'network-insights-access-scope-analysis'|'outpost-lag'|'placement-group'|'prefix-list'|'replace-root-volume-task'|'reserved-instances'|'route-table'|'security-group'|'security-group-rule'|'service-link-virtual-interface'|'snapshot'|'spot-fleet-request'|'spot-instances-request'|'subnet'|'subnet-cidr-reservation'|'traffic-mirror-filter'|'traffic-mirror-session'|'traffic-mirror-target'|'transit-gateway'|'transit-gateway-attachment'|'transit-gateway-connect-peer'|'transit-gateway-multicast-domain'|'transit-gateway-policy-table'|'transit-gateway-route-table'|'transit-gateway-route-table-announcement'|'volume'|'vpc'|'vpc-endpoint'|'vpc-endpoint-connection'|'vpc-endpoint-service'|'vpc-endpoint-service-permission'|'vpc-peering-connection'|'vpn-connection'|'vpn-gateway'|'vpc-flow-log'|'capacity-reservation-fleet'|'traffic-mirror-filter-rule'|'vpc-endpoint-connection-device-type'|'verified-access-instance'|'verified-access-group'|'verified-access-endpoint'|'verified-access-policy'|'verified-access-trust-provider'|'vpn-connection-device-type'|'vpc-block-public-access-exclusion'|'route-server'|'route-server-endpoint'|'route-server-peer'|'ipam-resource-discovery'|'ipam-resource-discovery-association'|'instance-connect-endpoint'|'verified-access-endpoint-target'|'ipam-external-resource-verification-token'|'capacity-block'|'mac-modification-task'|'capacity-manager-data-export',
            'Tags': [
                {
                    'Key': 'string',
                    'Value': 'string'
                },
            ]
        },
    ],
    MultiAttachEnabled=True|False,
    Throughput=123,
    ClientToken='string'
)
Parameters:
  • SourceVolumeId (string) –

    [REQUIRED]

    The ID of the source EBS volume to copy.

  • Iops (integer) –

    The number of I/O operations per second (IOPS) to provision for the volume copy. Required for io1 and io2 volumes. Optional for gp3 volumes. Omit for all other volume types. Full provisioned IOPS performance can be achieved only once the volume copy is fully initialized.

    Valid ranges:

    • gp3: 3,000 ``(*default*) `` - 80,000 IOPS

    • io1: 100 - 64,000 IOPS

    • io2: 100 - 256,000 IOPS

    Note

    Instances built on the Nitro System can support up to 256,000 IOPS. Other instances can support up to 32,000 IOPS.

  • Size (integer) –

    The size of the volume copy, in GiBs. The size must be equal to or greater than the size of the source volume. If not specified, the size defaults to the size of the source volume.

    Maximum supported sizes:

    • gp2: 16,384 GiB

    • gp3: 65,536 GiB

    • io1: 16,384 GiB

    • io2: 65,536 GiB

    • st1 and sc1: 16,384 GiB

    • standard: 1024 GiB

  • VolumeType (string) – The volume type for the volume copy. If not specified, the volume type defaults to gp2.

  • DryRun (boolean) – 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.

  • TagSpecifications (list) –

    The tags to apply to the volume copy during creation.

    • (dict) –

      The tags to apply to a resource when the resource is being created. When you specify a tag, you must specify the resource type to tag, otherwise the request will fail.

      Note

      The Valid Values lists all the resource types that can be tagged. However, the action you’re using might not support tagging all of these resource types. If you try to tag a resource type that is unsupported for the action you’re using, you’ll get an error.

      • ResourceType (string) –

        The type of resource to tag on creation.

      • Tags (list) –

        The tags to apply to the resource.

        • (dict) –

          Describes a tag.

          • Key (string) –

            The key of the tag.

            Constraints: Tag keys are case-sensitive and accept a maximum of 127 Unicode characters. May not begin with aws:.

          • Value (string) –

            The value of the tag.

            Constraints: Tag values are case-sensitive and accept a maximum of 256 Unicode characters.

  • MultiAttachEnabled (boolean) – Indicates whether to enable Amazon EBS Multi-Attach for the volume copy. If you enable Multi-Attach, you can attach the volume to up to 16 Nitro instances in the same Availability Zone simultaneously. Supported with io1 and io2 volumes only. For more information, see Amazon EBS Multi-Attach.

  • Throughput (integer) –

    The throughput to provision for the volume copy, in MiB/s. Supported for gp3 volumes only. Omit for all other volume types. Full provisioned throughput performance can be achieved only once the volume copy is fully initialized.

    Valid Range: 125 - 2000 MiB/s

  • ClientToken (string) –

    Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see Ensure Idempotency.

    This field is autopopulated if not provided.

Return type:

dict

Returns:

Response Syntax

{
    'Volumes': [
        {
            'AvailabilityZoneId': 'string',
            'OutpostArn': 'string',
            'SourceVolumeId': 'string',
            'Iops': 123,
            'Tags': [
                {
                    'Key': 'string',
                    'Value': 'string'
                },
            ],
            'VolumeType': 'standard'|'io1'|'io2'|'gp2'|'sc1'|'st1'|'gp3',
            'FastRestored': True|False,
            'MultiAttachEnabled': True|False,
            'Throughput': 123,
            'SseType': 'sse-ebs'|'sse-kms'|'none',
            'Operator': {
                'Managed': True|False,
                'Principal': 'string'
            },
            'VolumeInitializationRate': 123,
            'VolumeId': 'string',
            'Size': 123,
            'SnapshotId': 'string',
            'AvailabilityZone': 'string',
            'State': 'creating'|'available'|'in-use'|'deleting'|'deleted'|'error',
            'CreateTime': datetime(2015, 1, 1),
            'Attachments': [
                {
                    'DeleteOnTermination': True|False,
                    'AssociatedResource': 'string',
                    'InstanceOwningService': 'string',
                    'VolumeId': 'string',
                    'InstanceId': 'string',
                    'Device': 'string',
                    'State': 'attaching'|'attached'|'detaching'|'detached'|'busy',
                    'AttachTime': datetime(2015, 1, 1)
                },
            ],
            'Encrypted': True|False,
            'KmsKeyId': 'string'
        },
    ]
}

Response Structure

  • (dict) –

    • Volumes (list) –

      Information about the volume copy.

      • (dict) –

        Describes a volume.

        • AvailabilityZoneId (string) –

          The ID of the Availability Zone for the volume.

        • OutpostArn (string) –

          The Amazon Resource Name (ARN) of the Outpost.

        • SourceVolumeId (string) –

          The ID of the source volume from which the volume copy was created. Only for volume copies.

        • 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.

        • Tags (list) –

          Any tags assigned to the volume.

          • (dict) –

            Describes a tag.

            • Key (string) –

              The key of the tag.

              Constraints: Tag keys are case-sensitive and accept a maximum of 127 Unicode characters. May not begin with aws:.

            • Value (string) –

              The value of the tag.

              Constraints: Tag values are case-sensitive and accept a maximum of 256 Unicode characters.

        • VolumeType (string) –

          The volume type.

        • FastRestored (boolean) –

          Note

          This parameter is not returned by CreateVolume.

          Indicates whether the volume was created using fast snapshot restore.

        • MultiAttachEnabled (boolean) –

          Indicates whether Amazon EBS Multi-Attach is enabled.

        • Throughput (integer) –

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

        • SseType (string) –

          Note

          This parameter is not returned by CreateVolume.

          Reserved for future use.

        • Operator (dict) –

          The service provider that manages the volume.

          • Managed (boolean) –

            If true, the resource is managed by a service provider.

          • Principal (string) –

            If managed is true, then the principal is returned. The principal is the service provider that manages the resource.

        • VolumeInitializationRate (integer) –

          The Amazon EBS Provisioned Rate for Volume Initialization (volume initialization rate) specified for the volume during creation, in MiB/s. If no volume initialization rate was specified, the value is null.

        • VolumeId (string) –

          The ID of the volume.

        • Size (integer) –

          The size of the volume, in GiBs.

        • SnapshotId (string) –

          The snapshot from which the volume was created, if applicable.

        • AvailabilityZone (string) –

          The Availability Zone for the volume.

        • State (string) –

          The volume state.

        • CreateTime (datetime) –

          The time stamp when volume creation was initiated.

        • Attachments (list) –

          Note

          This parameter is not returned by CreateVolume.

          Information about the volume attachments.

          • (dict) –

            Describes volume attachment details.

            • DeleteOnTermination (boolean) –

              Indicates whether the EBS volume is deleted on instance termination.

            • AssociatedResource (string) –

              The ARN of the Amazon Web Services-managed resource to which the volume is attached.

            • InstanceOwningService (string) –

              The service principal of the Amazon Web Services service that owns the underlying resource to which the volume is attached.

              This parameter is returned only for volumes that are attached to Amazon Web Services-managed resources.

            • VolumeId (string) –

              The ID of the volume.

            • InstanceId (string) –

              The ID of the instance.

              If the volume is attached to an Amazon Web Services-managed resource, this parameter returns null.

            • Device (string) –

              The device name.

              If the volume is attached to an Amazon Web Services-managed resource, this parameter returns null.

            • State (string) –

              The attachment state of the volume.

            • AttachTime (datetime) –

              The time stamp when the attachment initiated.

        • Encrypted (boolean) –

          Indicates whether the volume is encrypted.

        • KmsKeyId (string) –

          The Amazon Resource Name (ARN) of the KMS key that was used to protect the volume encryption key for the volume.