FEATURES PRICING ABOUT DOCS LOGIN

aws_ami

The AMI resource allows the creation and management of a completely-custom Amazon Machine Image (AMI).

If you just want to duplicate an existing AMI, possibly copying it to another region, it’s better to use aws_ami_copy instead.

If you just want to share an existing AMI with another AWS account, it’s better to use aws_ami_launch_permission instead.

Example Usage

# Create an AMI that will start a machine whose root device is backed by
# an EBS volume populated from a snapshot. It is assumed that such a snapshot
# already exists with the id "snap-xxxxxxxx".
resource "aws_ami" "example" {
    name = "terraform-example"
    virtualization_type = "hvm"
    root_device_name = "/dev/xvda"

    ebs_block_device {
        device_name = "/dev/xvda"
        snapshot_id = "snap-xxxxxxxx"
        volume_size = 8
    }
}

Argument Reference

The following arguments are supported:

When virtualization_type is “paravirtual” the following additional arguments apply:

When virtualization_type is “hvm” the following additional arguments apply:

Nested ebs_block_device blocks have the following structure:

Nested ephemeral_block_device blocks have the following structure:

Attributes Reference

The following attributes are exported:


See the source of this document at Terraform.io

REQUEST A DEMO