Class AmiFromInstance


  • public class AmiFromInstance
    extends com.pulumi.resources.CustomResource
    The "AMI from instance" resource allows the creation of an Amazon Machine Image (AMI) modelled after an existing EBS-backed EC2 instance. The created AMI will refer to implicitly-created snapshots of the instance's EBS volumes and mimick its assigned block device configuration at the time the resource is created. This resource is best applied to an instance that is stopped when this instance is created, so that the contents of the created image are predictable. When applied to an instance that is running, *the instance will be stopped before taking the snapshots and then started back up again*, resulting in a period of downtime. Note that the source instance is inspected only at the initial creation of this resource. Ongoing updates to the referenced instance will not be propagated into the generated AMI. Users may taint or otherwise recreate the resource in order to produce a fresh snapshot. ## Example Usage <!--Start PulumiCodeChooser --> ```java package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.aws.ec2.AmiFromInstance; import com.pulumi.aws.ec2.AmiFromInstanceArgs; import java.util.List; import java.util.ArrayList; 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) { var example = new AmiFromInstance("example", AmiFromInstanceArgs.builder() .name("example") .sourceInstanceId("i-xxxxxxxx") .build()); } } ``` <!--End PulumiCodeChooser -->
    • Nested Class Summary

      • Nested classes/interfaces inherited from class com.pulumi.resources.CustomResource

        com.pulumi.resources.CustomResource.CustomResourceInternal
      • Nested classes/interfaces inherited from class com.pulumi.resources.Resource

        com.pulumi.resources.Resource.LazyField<T extends java.lang.Object>, com.pulumi.resources.Resource.LazyFields, com.pulumi.resources.Resource.ResourceInternal
    • Field Summary

      • Fields inherited from class com.pulumi.resources.Resource

        childResources, remote
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      com.pulumi.core.Output<java.lang.String> architecture()  
      com.pulumi.core.Output<java.lang.String> arn()  
      com.pulumi.core.Output<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<AmiFromInstanceEbsBlockDevice>> ebsBlockDevices()  
      com.pulumi.core.Output<java.lang.Boolean> enaSupport()  
      com.pulumi.core.Output<java.util.List<AmiFromInstanceEphemeralBlockDevice>> ephemeralBlockDevices()  
      static AmiFromInstance get​(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, AmiFromInstanceState 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.lang.String> imdsSupport()  
      com.pulumi.core.Output<java.lang.String> kernelId()  
      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.lang.String> ramdiskId()  
      com.pulumi.core.Output<java.lang.String> rootDeviceName()  
      com.pulumi.core.Output<java.lang.String> rootSnapshotId()  
      com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> snapshotWithoutReboot()  
      com.pulumi.core.Output<java.lang.String> sourceInstanceId()  
      com.pulumi.core.Output<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.lang.String> tpmSupport()  
      com.pulumi.core.Output<java.lang.String> usageOperation()  
      com.pulumi.core.Output<java.lang.String> virtualizationType()  
      • Methods inherited from class com.pulumi.resources.CustomResource

        getId, id, idFuture
      • Methods inherited from class com.pulumi.resources.Resource

        getChildResources, getResourceName, getResourceType, getUrn, pulumiChildResources, pulumiResourceName, pulumiResourceType, urn
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AmiFromInstance

        public AmiFromInstance​(java.lang.String name)
        Parameters:
        name - The _unique_ name of the resulting resource.
      • AmiFromInstance

        public AmiFromInstance​(java.lang.String name,
                               AmiFromInstanceArgs args)
        Parameters:
        name - The _unique_ name of the resulting resource.
        args - The arguments to use to populate this resource's properties.
      • AmiFromInstance

        public AmiFromInstance​(java.lang.String name,
                               AmiFromInstanceArgs 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.lang.String> architecture()
        Returns:
        Machine architecture for created instances. Defaults to "x86_64".
      • arn

        public com.pulumi.core.Output<java.lang.String> arn()
        Returns:
        ARN of the AMI.
      • bootMode

        public com.pulumi.core.Output<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 Amazon Elastic Compute Cloud 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<AmiFromInstanceEbsBlockDevice>> 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.lang.Boolean> enaSupport()
        Returns:
        Whether enhanced networking with ENA is enabled. Defaults to `false`.
      • ephemeralBlockDevices

        public com.pulumi.core.Output<java.util.List<AmiFromInstanceEphemeralBlockDevice>> 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()
      • imageLocation

        public com.pulumi.core.Output<java.lang.String> imageLocation()
        Returns:
        Path to an S3 object containing an image manifest, e.g., created by the `ec2-upload-bundle` command in the EC2 command line tools.
      • imageOwnerAlias

        public com.pulumi.core.Output<java.lang.String> imageOwnerAlias()
      • imageType

        public com.pulumi.core.Output<java.lang.String> imageType()
      • imdsSupport

        public com.pulumi.core.Output<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.lang.String> kernelId()
        Returns:
        ID of the kernel image (AKI) that will be used as the paravirtual kernel in created instances.
      • 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()
      • platform

        public com.pulumi.core.Output<java.lang.String> platform()
      • platformDetails

        public com.pulumi.core.Output<java.lang.String> platformDetails()
      • public_

        public com.pulumi.core.Output<java.lang.Boolean> public_()
      • ramdiskId

        public com.pulumi.core.Output<java.lang.String> ramdiskId()
        Returns:
        ID of an initrd image (ARI) that will be used when booting the created instances.
      • rootDeviceName

        public com.pulumi.core.Output<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()
      • snapshotWithoutReboot

        public com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> snapshotWithoutReboot()
        Returns:
        Boolean that overrides the behavior of stopping the instance before snapshotting. This is risky since it may cause a snapshot of an inconsistent filesystem state, but can be used to avoid downtime if the user otherwise guarantees that no filesystem writes will be underway at the time of snapshot.
      • sourceInstanceId

        public com.pulumi.core.Output<java.lang.String> sourceInstanceId()
        Returns:
        ID of the instance to use as the basis of the AMI.
      • sriovNetSupport

        public com.pulumi.core.Output<java.lang.String> sriovNetSupport()
        Returns:
        When set to "simple" (the default), enables enhanced networking for created instances. No other value is supported at this time.
      • 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 `default_tags` 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()
      • tpmSupport

        public com.pulumi.core.Output<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 Amazon Elastic Compute Cloud User Guide.
      • usageOperation

        public com.pulumi.core.Output<java.lang.String> usageOperation()
      • virtualizationType

        public com.pulumi.core.Output<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 AmiFromInstance get​(java.lang.String name,
                                          com.pulumi.core.Output<java.lang.String> id,
                                          @Nullable
                                          AmiFromInstanceState 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.