2015-08-30 06:35:45 +02:00
---
layout: "aws"
page_title: "AWS: aws_ami_copy"
sidebar_current: "docs-aws-resource-ami-copy"
description: |-
Duplicates an existing Amazon Machine Image (AMI)
---
# aws\_ami\_copy
The "AMI copy" resource allows duplication of an Amazon Machine Image (AMI),
including cross-region copies.
If the source AMI has associated EBS snapshots, those will also be duplicated
along with the AMI.
This is useful for taking a single AMI provisioned in one region and making
it available in another for a multi-region deployment.
Copying an AMI can take several minutes. The creation of this resource will
block until the new AMI is available for use on new instances.
## Example Usage
```
resource "aws_ami_copy" "example" {
name = "terraform-example"
2016-02-13 14:36:09 +01:00
description = "A copy of ami-xxxxxxxx"
2015-08-30 06:35:45 +02:00
source_ami_id = "ami-xxxxxxxx"
source_ami_region = "us-west-1"
2016-02-13 14:36:09 +01:00
tags {
Name = "HelloWorld"
}
2015-08-30 06:35:45 +02:00
}
```
## Argument Reference
The following arguments are supported:
* `name` - (Required) A region-unique name for the AMI.
* `source_ami_id` - (Required) The id of the AMI to copy. This id must be valid in the region
given by `source_ami_region` .
* `source_region` - (Required) The region from which the AMI will be copied. This may be the
same as the AWS provider region in order to create a copy within the same region.
2016-08-05 02:38:00 +02:00
* `encrypted` - (Optional) Specifies whether the destination snapshots of the copied image should be encrypted. Defaults to `false`
* `kms_key_id` - (Optional) The full ARN of the KMS Key to use when encrypting the snapshots of an image during a copy operation. If not specified, then the default AWS KMS Key will be used
2015-08-30 06:35:45 +02:00
2016-02-13 14:36:09 +01:00
This resource also exposes the full set of arguments from the [`aws_ami` ](ami.html ) resource.
2015-08-30 06:35:45 +02:00
## Attributes Reference
The following attributes are exported:
* `id` - The ID of the created AMI.
This resource also exports a full set of attributes corresponding to the arguments of the
2016-02-13 14:36:09 +01:00
[`aws_ami` ](ami.html ) resource, allowing the properties of the created AMI to be used elsewhere in the
2015-08-30 06:35:45 +02:00
configuration.