github.com/jmbataller/terraform@v0.6.8-0.20151125192640-b7a12e3a580c/website/source/docs/providers/aws/r/ami.html.markdown (about)

     1  ---
     2  layout: "aws"
     3  page_title: "AWS: aws_ami"
     4  sidebar_current: "docs-aws-resource-ami"
     5  description: |-
     6    Creates and manages a custom Amazon Machine Image (AMI).
     7  ---
     8  
     9  # aws\_ami
    10  
    11  The AMI resource allows the creation and management of a completely-custom
    12  *Amazon Machine Image* (AMI).
    13  
    14  If you just want to duplicate an existing AMI, possibly copying it to another
    15  region, it's better to use `aws_ami_copy` instead.
    16  
    17  ## Example Usage
    18  
    19  ```
    20  # Create an AMI that will start a machine whose root device is backed by
    21  # an EBS volume populated from a snapshot. It is assumed that such a snapshot
    22  # already exists with the id "snap-xxxxxxxx".
    23  resource "aws_ami" "example" {
    24      name = "terraform-example"
    25      virtualization_type = "hvm"
    26      root_device_name = "/dev/xvda"
    27  
    28      ebs_block_device {
    29          device_name = "/dev/xvda"
    30          snapshot_id = "snap-xxxxxxxx"
    31          volume_size = 8
    32      }
    33  }
    34  ```
    35  
    36  ## Argument Reference
    37  
    38  The following arguments are supported:
    39  
    40  * `name` - (Required) A region-unique name for the AMI.
    41  * `description` - (Optional) A longer, human-readable description for the AMI.
    42  * `virtualization_type` - (Optional) Keyword to choose what virtualization mode created instances
    43    will use. Can be either "paravirtual" (the default) or "hvm". The choice of virtualization type
    44    changes the set of further arguments that are required, as described below.
    45  * `architecture` - (Optional) Machine architecture for created instances. Defaults to "x86_64".
    46  * `ebs_block_device` - (Optional) Nested block describing an EBS block device that should be
    47    attached to created instances. The structure of this block is described below.
    48  * `ephemeral_block_device` - (Optional) Nested block describing an ephemeral block device that
    49    should be attached to created instances. The structure of this block is described below.
    50  
    51  When `virtualization_type` is "paravirtual" the following additional arguments apply:
    52  
    53  * `image_location` - (Required) Path to an S3 object containing an image manifest, e.g. created
    54    by the `ec2-upload-bundle` command in the EC2 command line tools.
    55  * `kernel_id` - (Required) The id of the kernel image (AKI) that will be used as the paravirtual
    56    kernel in created instances.
    57  * `ramdisk_id` - (Optional) The id of an initrd image (ARI) that will be used when booting the
    58    created instances.
    59  
    60  When `virtualization_type` is "hvm" the following additional arguments apply:
    61  
    62  * `sriov_net_support` - (Optional) When set to "simple" (the default), enables enhanced networking
    63    for created instances. No other value is supported at this time.
    64  
    65  Nested `ebs_block_device` blocks have the following structure:
    66  
    67  * `device_name` - (Required) The path at which the device is exposed to created instances.
    68  * `delete_on_termination` - (Optional) Boolean controlling whether the EBS volumes created to
    69    support each created instance will be deleted once that instance is terminated.
    70  * `encrypted` - (Optional) Boolean controlling whether the created EBS volumes will be encrypted.
    71  * `iops` - (Required only when `volume_type` is "io1") Number of I/O operations per second the
    72    created volumes will support.
    73  * `snapshot_id` - (Optional) The id of an EBS snapshot that will be used to initialize the created
    74    EBS volumes. If set, the `volume_size` attribute must be at least as large as the referenced
    75    snapshot.
    76  * `volume_size` - (Required unless `snapshot_id` is set) The size of created volumes in GiB.
    77    If `snapshot_id` is set and `volume_size` is omitted then the volume will have the same size
    78    as the selected snapshot.
    79  * `volume_type` - (Optional) The type of EBS volume to create. Can be one of "standard" (the
    80    default), "io1" or "gp2".
    81  
    82  Nested `ephemeral_block_device` blocks have the following structure:
    83  
    84  * `device_name` - (Required) The path at which the device is exposed to created instances.
    85  * `virtual_name` - (Required) A name for the ephemeral device, of the form "ephemeralN" where
    86    *N* is a volume number starting from zero.
    87  
    88  ## Attributes Reference
    89  
    90  The following attributes are exported:
    91  
    92  * `id` - The ID of the created AMI.