{
  "typeName" : "AWS::EC2::Volume",
  "description" : "Specifies an Amazon Elastic Block Store (Amazon EBS) volume. You can create an empty volume, a volume from a snapshot, or a volume copy from an existing source volume.\n   +  When you use CFNlong to update an Amazon EBS volume that modifies ``Iops``, ``Size``, or ``VolumeType``, there is a cooldown period before another operation can occur. This can cause your stack to report being in ``UPDATE_IN_PROGRESS`` or ``UPDATE_ROLLBACK_IN_PROGRESS`` for long periods of time. Some common scenarios when you might encounter a cooldown period for Amazon EBS include:\n  +  You successfully update an Amazon EBS volume and the update succeeds. When you attempt another update within the cooldown window, that update will be subject to a cooldown period.\n  +  You successfully update an Amazon EBS volume and the update succeeds but another change in your ``update-stack`` call fails. The rollback will be subject to a cooldown period.\n  \n For more information, see [Requirements for EBS volume modifications](https://docs.aws.amazon.com/ebs/latest/userguide/modify-volume-requirements.html).\n  +  Amazon EBS does not support sizing down an Amazon EBS volume. CFNlong does not attempt to modify an Amazon EBS volume to a smaller size on rollback.\n  \n   *DeletionPolicy attribute* \n To control how CFNlong handles the volume when the stack is deleted, set a deletion policy for your volume. You can choose to retain the volume, to delete the volume, or to create a snapshot of the volume. For more information, see [DeletionPolicy attribute](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html).\n  If you set a deletion policy that creates a snapshot, all tags on the volume are included in the snapshot.",
  "sourceUrl" : "https://github.com/aws-cloudformation/aws-cloudformation-resource-providers-ec2.git",
  "additionalProperties" : false,
  "properties" : {
    "MultiAttachEnabled" : {
      "type" : "boolean",
      "description" : "Indicates whether Amazon EBS Multi-Attach is enabled.\n CFNlong does not currently support updating a single-attach volume to be multi-attach enabled, updating a multi-attach enabled volume to be single-attach, or updating the size or number of I/O operations per second (IOPS) of a multi-attach enabled volume."
    },
    "KmsKeyId" : {
      "type" : "string",
      "description" : "The identifier of the kms-key-long to use for Amazon EBS encryption. If ``KmsKeyId`` is specified, the encrypted state must be ``true``.\n If you omit this property and your account is enabled for encryption by default, or *Encrypted* is set to ``true``, then the volume is encrypted using the default key specified for your account. If your account does not have a default key, then the volume is encrypted using the aws-managed-key.\n Alternatively, if you want to specify a different key, you can specify one of the following:\n  +  Key ID. For example, 1234abcd-12ab-34cd-56ef-1234567890ab.\n  +  Key alias. Specify the alias for the key, prefixed with ``alias/``. For example, for a key with the alias ``my_cmk``, use ``alias/my_cmk``. Or to specify the aws-managed-key, use ``alias/aws/ebs``.\n  +  Key ARN. For example, arn:aws:kms:us-east-1:012345678910:key/1234abcd-12ab-34cd-56ef-1234567890ab.\n  +  Alias ARN. For example, arn:aws:kms:us-east-1:012345678910:alias/ExampleAlias.\n  \n If you are creating a volume copy, omit this parameter. The volume is automatically encrypted with the same KMS key as the source volume. You can't copy unencrypted volumes."
    },
    "Encrypted" : {
      "type" : "boolean",
      "description" : "Indicates whether the volume should be encrypted. The effect of setting the encryption state to ``true`` depends on the volume origin (new, from a snapshot, or from an existing volume), starting encryption state, ownership, and whether encryption by default is enabled. For more information, see [Encryption by default](https://docs.aws.amazon.com/ebs/latest/userguide/work-with-ebs-encr.html#encryption-by-default) in the *Amazon EBS User Guide*.\n If you are creating a volume copy, omit this parameter. The volume is automatically encrypted with the same KMS key as the source volume. You can't copy unencrypted volumes."
    },
    "Size" : {
      "type" : "integer",
      "description" : "The size of the volume, in GiBs.\n  +  Required for new empty volumes.\n  +  Optional for volumes created from snapshots and volume copies. In this case, the size defaults to the size of the snapshot or source volume. You can optionally specify a size that is equal to or larger than the size of the source snapshot or volume.\n  \n Supported volume sizes:\n  +  gp2: ``1 - 16,384`` GiB\n  +  gp3: ``1 - 65,536`` GiB\n  +  io1: ``4 - 16,384`` GiB\n  +  io2: ``4 - 65,536`` GiB\n  +  st1 and sc1: ``125 - 16,384`` GiB\n  +  standard: ``1 - 1024`` GiB"
    },
    "AutoEnableIO" : {
      "type" : "boolean",
      "description" : "Indicates whether the volume is auto-enabled for I/O operations. By default, EBS disables I/O to the volume from attached EC2 instances when it determines that a volume's data is potentially inconsistent. If the consistency of the volume is not a concern, and you prefer that the volume be made available immediately if it's impaired, you can configure the volume to automatically enable I/O."
    },
    "OutpostArn" : {
      "type" : "string",
      "description" : "The Amazon Resource Name (ARN) of the Outpost on which to create the volume.\n If you intend to use a volume with an instance running on an outpost, then you must create the volume on the same outpost as the instance. You can't use a volume created in an AWS Region with an instance on an AWS outpost, or the other way around."
    },
    "AvailabilityZone" : {
      "type" : "string",
      "description" : "The ID of the Availability Zone in which to create the volume. For example, ``us-east-1a``.\n Either ``AvailabilityZone`` or ``AvailabilityZoneId`` must be specified, but not both.\n If you are creating a volume copy, omit this parameter. The volume copy is created in the same Availability Zone as the source volume."
    },
    "AvailabilityZoneId" : {
      "type" : "string",
      "description" : "The ID of the Availability Zone in which to create the volume. For example, ``use1-az1``.\n Either ``AvailabilityZone`` or ``AvailabilityZoneId`` must be specified, but not both.\n If you are creating a volume copy, omit this parameter. The volume copy is created in the same Availability Zone as the source volume."
    },
    "Throughput" : {
      "type" : "integer",
      "description" : "The throughput to provision for a volume, with a maximum of 2,000 MiB/s.\n This parameter is valid only for ``gp3`` volumes. The default value is 125.\n Valid Range: Minimum value of 125. Maximum value of 2000.\n The maximum ratio of throughput to IOPS is 0.25 MiB/s per IOPS. For example, a volume with 3,000 IOPS can have a maximum throughput of 750 MiB/s (3,000 x 0.25)."
    },
    "Iops" : {
      "type" : "integer",
      "description" : "The number of I/O operations per second (IOPS) to provision for the volume. Required for ``io1`` and ``io2`` volumes. Optional for ``gp3`` volumes. Omit for all other volume types. \n Valid ranges:\n  +  gp3: ``3,000``(*default*)``- 80,000`` IOPS\n  +  io1: ``100 - 64,000`` IOPS\n  +  io2: ``100 - 256,000`` IOPS\n  \n  [Instances built on the Nitro System](https://docs.aws.amazon.com/ec2/latest/instancetypes/ec2-nitro-instances.html) can support up to 256,000 IOPS. Other instances can support up to 32,000 IOPS."
    },
    "SnapshotId" : {
      "type" : "string",
      "description" : "The snapshot from which to create the volume. Only specify to create a volume from a snapshot. To create a new empty volume, omit this parameter and specify a value for ``Size`` instead. To create a volume copy, omit this parameter and specify ``SourceVolumeId`` instead."
    },
    "SourceVolumeId" : {
      "type" : "string",
      "description" : "The ID of the source EBS volume to copy. When specified, the volume is created as an exact copy of the specified volume. Only specify to create a volume copy. To create a new empty volume or to create a volume from a snapshot, omit this parameter,"
    },
    "VolumeType" : {
      "type" : "string",
      "description" : "The volume type. This parameter can be one of the following values:\n  +  General Purpose SSD: ``gp2`` | ``gp3``\n  +  Provisioned IOPS SSD: ``io1`` | ``io2``\n  +  Throughput Optimized HDD: ``st1``\n  +  Cold HDD: ``sc1``\n  +  Magnetic: ``standard``\n  \n  Throughput Optimized HDD (``st1``) and Cold HDD (``sc1``) volumes can't be used as boot volumes.\n  For more information, see [Amazon EBS volume types](https://docs.aws.amazon.com/ebs/latest/userguide/ebs-volume-types.html) in the *Amazon EBS User Guide*.\n Default: ``gp2``"
    },
    "VolumeId" : {
      "type" : "string",
      "description" : ""
    },
    "Tags" : {
      "type" : "array",
      "uniqueItems" : false,
      "description" : "The tags to apply to the volume during creation.",
      "insertionOrder" : false,
      "items" : {
        "$ref" : "#/definitions/Tag"
      }
    },
    "VolumeInitializationRate" : {
      "type" : "integer",
      "description" : "Specifies the Amazon EBS Provisioned Rate for Volume Initialization (volume initialization rate), in MiB/s, at which to download the snapshot blocks from Amazon S3 to the volume. This is also known as *volume initialization*. Specifying a volume initialization rate ensures that the volume is initialized at a predictable and consistent rate after creation.\n This parameter is supported only for volumes created from snapshots. Omit this parameter if:\n  +  You want to create the volume using fast snapshot restore. You must specify a snapshot that is enabled for fast snapshot restore. In this case, the volume is fully initialized at creation.\n  If you specify a snapshot that is enabled for fast snapshot restore and a volume initialization rate, the volume will be initialized at the specified rate instead of fast snapshot restore.\n   +  You want to create a volume that is initialized at the default rate.\n  \n For more information, see [Initialize Amazon EBS volumes](https://docs.aws.amazon.com/ebs/latest/userguide/initalize-volume.html) in the *Amazon EC2 User Guide*.\n Valid range: 100 - 300 MiB/s"
    }
  },
  "definitions" : {
    "Tag" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "Key" : {
          "description" : "The tag key.",
          "type" : "string"
        },
        "Value" : {
          "description" : "The tag value.",
          "type" : "string"
        }
      },
      "required" : [ "Value", "Key" ],
      "description" : "Specifies a tag. For more information, see [Resource tags](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-resource-tags.html)."
    }
  },
  "tagging" : {
    "taggable" : true,
    "tagOnCreate" : true,
    "tagUpdatable" : true,
    "cloudFormationSystemTags" : false,
    "tagProperty" : "/properties/Tags",
    "permissions" : [ "ec2:CreateTags", "ec2:DeleteTags", "ec2:DescribeTags" ]
  },
  "handlers" : {
    "create" : {
      "permissions" : [ "ec2:CreateVolume", "ec2:CopyVolumes", "ec2:DescribeVolumes", "ec2:DescribeVolumeAttribute", "ec2:ModifyVolumeAttribute", "ec2:CreateTags", "kms:GenerateDataKeyWithoutPlaintext", "kms:CreateGrant", "kms:ReEncryptFrom", "kms:ReEncryptTo" ],
      "timeoutInMinutes" : 725
    },
    "read" : {
      "permissions" : [ "ec2:DescribeVolumes", "ec2:DescribeVolumeAttribute", "ec2:DescribeTags" ]
    },
    "update" : {
      "permissions" : [ "ec2:ModifyVolume", "ec2:ModifyVolumeAttribute", "ec2:DescribeVolumeAttribute", "ec2:DescribeVolumesModifications", "ec2:DescribeVolumes", "ec2:CreateTags", "ec2:DeleteTags" ],
      "timeoutInMinutes" : 2160
    },
    "delete" : {
      "permissions" : [ "ec2:DeleteVolume", "ec2:CreateSnapshot", "ec2:DescribeSnapshots", "ec2:DeleteTags", "ec2:DescribeVolumes" ]
    },
    "list" : {
      "permissions" : [ "ec2:DescribeVolumes", "ec2:DescribeTags", "ec2:DescribeVolumeAttribute" ]
    }
  },
  "anyOf" : [ {
    "required" : [ "AvailabilityZone", "Size" ],
    "description" : "Create a new empty volume with specified size"
  }, {
    "required" : [ "AvailabilityZone", "SnapshotId" ],
    "description" : "Create a volume from a snapshot"
  }, {
    "required" : [ "AvailabilityZoneId", "Size" ],
    "description" : "Create a new empty volume with specified size"
  }, {
    "required" : [ "AvailabilityZoneId", "SnapshotId" ],
    "description" : "Create a volume from a snapshot"
  }, {
    "required" : [ "SourceVolumeId" ],
    "description" : "Create a volume by copying from an existing volume"
  } ],
  "primaryIdentifier" : [ "/properties/VolumeId" ],
  "readOnlyProperties" : [ "/properties/VolumeId" ]
}