Package com.pulumi.aws.ec2
Class Ami
- java.lang.Object
-
- com.pulumi.resources.Resource
-
- com.pulumi.resources.CustomResource
-
- com.pulumi.aws.ec2.Ami
-
public class Ami extends com.pulumi.resources.CustomResourceThe AMI resource allows the creation and management of a completely-custom AMI. If you just want to duplicate an existing AMI, possibly copying it to another region, it's better to use `aws.ec2.AmiCopy` instead. If you just want to share an existing AMI with another AWS account, it's better to use `aws.ec2.AmiLaunchPermission` instead. ## Example Usage
## Import Using `pulumi import`, import `aws.ec2.Ami` using the ID of the AMI. For example: ```sh $ pulumi import aws:ec2/ami:Ami example ami-12345678 ```package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.aws.ec2.Ami; import com.pulumi.aws.ec2.AmiArgs; import com.pulumi.aws.ec2.inputs.AmiEbsBlockDeviceArgs; import java.util.ArrayList; import java.util.Arrays; import java.util.Map; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; public class App { public static void main(String[] args) { Pulumi.run(App::stack); } public static void stack(Context ctx) { // Create an AMI that will start a machine whose root device is backed by // an EBS volume populated from a snapshot. We assume that such a snapshot // already exists with the id "snap-xxxxxxxx". var example = new Ami("example", AmiArgs.builder() .ebsBlockDevices(AmiEbsBlockDeviceArgs.builder() .deviceName("/dev/xvda") .snapshotId("snap-xxxxxxxx") .volumeSize(8) .build()) .name("example") .virtualizationType("hvm") .rootDeviceName("/dev/xvda") .imdsSupport("v2.0") .build()); } }
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description com.pulumi.core.Output<java.util.Optional<java.lang.String>>architecture()com.pulumi.core.Output<java.lang.String>arn()com.pulumi.core.Output<java.util.Optional<java.lang.String>>bootMode()com.pulumi.core.Output<java.util.Optional<java.lang.String>>deprecationTime()com.pulumi.core.Output<java.util.Optional<java.lang.String>>description()com.pulumi.core.Output<java.util.List<AmiEbsBlockDevice>>ebsBlockDevices()com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>>enaSupport()com.pulumi.core.Output<java.util.List<AmiEphemeralBlockDevice>>ephemeralBlockDevices()static Amiget(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, AmiState state, com.pulumi.resources.CustomResourceOptions options)Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.com.pulumi.core.Output<java.lang.String>hypervisor()com.pulumi.core.Output<java.lang.String>imageLocation()com.pulumi.core.Output<java.lang.String>imageOwnerAlias()com.pulumi.core.Output<java.lang.String>imageType()com.pulumi.core.Output<java.util.Optional<java.lang.String>>imdsSupport()com.pulumi.core.Output<java.util.Optional<java.lang.String>>kernelId()com.pulumi.core.Output<java.lang.String>lastLaunchedTime()com.pulumi.core.Output<java.lang.Boolean>manageEbsSnapshots()com.pulumi.core.Output<java.lang.String>name()com.pulumi.core.Output<java.lang.String>ownerId()com.pulumi.core.Output<java.lang.String>platform()com.pulumi.core.Output<java.lang.String>platformDetails()com.pulumi.core.Output<java.lang.Boolean>public_()com.pulumi.core.Output<java.util.Optional<java.lang.String>>ramdiskId()com.pulumi.core.Output<java.lang.String>region()com.pulumi.core.Output<java.util.Optional<java.lang.String>>rootDeviceName()com.pulumi.core.Output<java.lang.String>rootSnapshotId()com.pulumi.core.Output<java.util.Optional<java.lang.String>>sriovNetSupport()com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,java.lang.String>>>tags()com.pulumi.core.Output<java.util.Map<java.lang.String,java.lang.String>>tagsAll()com.pulumi.core.Output<java.util.Optional<java.lang.String>>tpmSupport()com.pulumi.core.Output<java.util.Optional<java.lang.String>>uefiData()com.pulumi.core.Output<java.lang.String>usageOperation()com.pulumi.core.Output<java.util.Optional<java.lang.String>>virtualizationType()
-
-
-
Constructor Detail
-
Ami
public Ami(java.lang.String name)
- Parameters:
name- The _unique_ name of the resulting resource.
-
Ami
public Ami(java.lang.String name, @Nullable AmiArgs args)- Parameters:
name- The _unique_ name of the resulting resource.args- The arguments to use to populate this resource's properties.
-
Ami
public Ami(java.lang.String name, @Nullable AmiArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options)- Parameters:
name- The _unique_ name of the resulting resource.args- The arguments to use to populate this resource's properties.options- A bag of options that control this resource's behavior.
-
-
Method Detail
-
architecture
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> architecture()
- Returns:
- Machine architecture for created instances. Defaults to `x8664`.
-
arn
public com.pulumi.core.Output<java.lang.String> arn()
- Returns:
- ARN of the AMI.
-
bootMode
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> bootMode()
- Returns:
- Boot mode of the AMI. For more information, see [Boot modes](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ami-boot.html) in the EC2 User Guide.
-
deprecationTime
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> deprecationTime()
- Returns:
- Date and time to deprecate the AMI. If you specified a value for seconds, Amazon EC2 rounds the seconds to the nearest minute. Valid values: [RFC3339 time string](https://tools.ietf.org/html/rfc3339#section-5.8) (`YYYY-MM-DDTHH:MM:SSZ`)
-
description
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> description()
- Returns:
- Longer, human-readable description for the AMI.
-
ebsBlockDevices
public com.pulumi.core.Output<java.util.List<AmiEbsBlockDevice>> ebsBlockDevices()
- Returns:
- Nested block describing an EBS block device that should be attached to created instances. The structure of this block is described below.
-
enaSupport
public com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> enaSupport()
- Returns:
- Whether enhanced networking with ENA is enabled. Defaults to `false`.
-
ephemeralBlockDevices
public com.pulumi.core.Output<java.util.List<AmiEphemeralBlockDevice>> ephemeralBlockDevices()
- Returns:
- Nested block describing an ephemeral block device that should be attached to created instances. The structure of this block is described below.
-
hypervisor
public com.pulumi.core.Output<java.lang.String> hypervisor()
- Returns:
- Hypervisor type of the image.
-
imageLocation
public com.pulumi.core.Output<java.lang.String> imageLocation()
-
imageOwnerAlias
public com.pulumi.core.Output<java.lang.String> imageOwnerAlias()
- Returns:
- AWS account alias (for example, amazon, self) or the AWS account ID of the AMI owner.
-
imageType
public com.pulumi.core.Output<java.lang.String> imageType()
- Returns:
- Type of image.
-
imdsSupport
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> imdsSupport()
- Returns:
- If EC2 instances started from this image should require the use of the Instance Metadata Service V2 (IMDSv2), set this argument to `v2.0`. For more information, see [Configure instance metadata options for new instances](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/configuring-IMDS-new-instances.html#configure-IMDS-new-instances-ami-configuration).
-
kernelId
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> kernelId()
-
lastLaunchedTime
public com.pulumi.core.Output<java.lang.String> lastLaunchedTime()
- Returns:
- Date and time, in ISO 8601 date-time format , when the AMI was last used to launch an EC2 instance. When the AMI is used to launch an instance, there is a 24-hour delay before that usage is reported. For more information, see the following [AWS document](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ami-last-launched-time.html).
-
manageEbsSnapshots
public com.pulumi.core.Output<java.lang.Boolean> manageEbsSnapshots()
-
name
public com.pulumi.core.Output<java.lang.String> name()
- Returns:
- Region-unique name for the AMI.
-
ownerId
public com.pulumi.core.Output<java.lang.String> ownerId()
- Returns:
- AWS account ID of the image owner.
-
platform
public com.pulumi.core.Output<java.lang.String> platform()
- Returns:
- This value is set to windows for Windows AMIs; otherwise, it is blank.
-
platformDetails
public com.pulumi.core.Output<java.lang.String> platformDetails()
- Returns:
- Platform details associated with the billing code of the AMI.
-
public_
public com.pulumi.core.Output<java.lang.Boolean> public_()
- Returns:
- Whether the image has public launch permissions.
-
ramdiskId
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> ramdiskId()
-
region
public com.pulumi.core.Output<java.lang.String> region()
- Returns:
- Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration.
-
rootDeviceName
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> rootDeviceName()
- Returns:
- Name of the root device (for example, `/dev/sda1`, or `/dev/xvda`).
-
rootSnapshotId
public com.pulumi.core.Output<java.lang.String> rootSnapshotId()
- Returns:
- Snapshot ID for the root volume (for EBS-backed AMIs)
-
sriovNetSupport
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> sriovNetSupport()
-
tags
public com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,java.lang.String>>> tags()
- Returns:
- Map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
-
tagsAll
public com.pulumi.core.Output<java.util.Map<java.lang.String,java.lang.String>> tagsAll()
- Returns:
- Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
-
tpmSupport
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> tpmSupport()
- Returns:
- If the image is configured for NitroTPM support, the value is `v2.0`. For more information, see [NitroTPM](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/nitrotpm.html) in the EC2 User Guide.
-
uefiData
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> uefiData()
- Returns:
- Base64 representation of the non-volatile UEFI variable store.
-
usageOperation
public com.pulumi.core.Output<java.lang.String> usageOperation()
- Returns:
- Operation of the Amazon EC2 instance and the billing code that is associated with the AMI.
-
virtualizationType
public com.pulumi.core.Output<java.util.Optional<java.lang.String>> virtualizationType()
- Returns:
- Keyword to choose what virtualization mode created instances will use. Can be either "paravirtual" (the default) or "hvm". The choice of virtualization type changes the set of further arguments that are required, as described below.
-
get
public static Ami get(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, @Nullable AmiState state, @Nullable com.pulumi.resources.CustomResourceOptions options)
Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.- Parameters:
name- The _unique_ name of the resulting resource.id- The _unique_ provider ID of the resource to lookup.state-options- Optional settings to control the behavior of the CustomResource.
-
-