Ami class
The 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 * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
// 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".
const example = new aws.ec2.Ami("example", {
ebsBlockDevices: [{
deviceName: "/dev/xvda",
snapshotId: "snap-xxxxxxxx",
volumeSize: 8,
}],
name: "example",
virtualizationType: "hvm",
rootDeviceName: "/dev/xvda",
imdsSupport: "v2.0",
});
import pulumi
import pulumi_aws as aws
# 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".
example = aws.ec2.Ami("example",
ebs_block_devices=[{
"device_name": "/dev/xvda",
"snapshot_id": "snap-xxxxxxxx",
"volume_size": 8,
}],
name="example",
virtualization_type="hvm",
root_device_name="/dev/xvda",
imds_support="v2.0")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
// 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 Aws.Ec2.Ami("example", new()
{
EbsBlockDevices = new[]
{
new Aws.Ec2.Inputs.AmiEbsBlockDeviceArgs
{
DeviceName = "/dev/xvda",
SnapshotId = "snap-xxxxxxxx",
VolumeSize = 8,
},
},
Name = "example",
VirtualizationType = "hvm",
RootDeviceName = "/dev/xvda",
ImdsSupport = "v2.0",
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/ec2"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
// 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".
_, err := ec2.NewAmi(ctx, "example", &ec2.AmiArgs{
EbsBlockDevices: ec2.AmiEbsBlockDeviceArray{
&ec2.AmiEbsBlockDeviceArgs{
DeviceName: pulumi.String("/dev/xvda"),
SnapshotId: pulumi.String("snap-xxxxxxxx"),
VolumeSize: pulumi.Int(8),
},
},
Name: pulumi.String("example"),
VirtualizationType: pulumi.String("hvm"),
RootDeviceName: pulumi.String("/dev/xvda"),
ImdsSupport: pulumi.String("v2.0"),
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
# 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".
resource "aws_ec2_ami" "example" {
ebs_block_devices {
device_name = "/dev/xvda"
snapshot_id = "snap-xxxxxxxx"
volume_size = 8
}
name = "example"
virtualization_type = "hvm"
root_device_name = "/dev/xvda"
imds_support = "v2.0"
}
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());
}
}
resources:
# 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".
example:
type: aws:ec2:Ami
properties:
ebsBlockDevices:
- deviceName: /dev/xvda
snapshotId: snap-xxxxxxxx
volumeSize: 8
name: example
virtualizationType: hvm
rootDeviceName: /dev/xvda
imdsSupport: v2.0
Import
Using pulumi import, import aws.ec2.Ami using the ID of the AMI. For example:
$ pulumi import aws:ec2/ami:Ami example ami-12345678
Constructors
- Ami(String name, {AmiArgs? args, CustomResourceOptions? options})
-
Creates a new Ami.
nameThe Pulumi resource name.argsArguments used to configure this Ami. The set of arguments for Ami.optionsResource options controlling this resource's behavior. - Ami.reference(String urn)
- Creates a typed reference to an existing Ami resource.
Properties
-
architecture
↔ Output<
String?> -
Machine architecture for created instances. Defaults to
x8664.latefinal -
arn
↔ Output<
String> -
ARN of the AMI.
latefinal
-
bootMode
↔ Output<
String?> -
Boot mode of the AMI. For more information, see Boot modes in the EC2 User Guide.
latefinal
-
childResources
→ Set<
Resource> -
finalinherited
-
completionSources
↔ Map<
String, IOutputCompletionSource> -
latefinalinherited
-
deprecationTime
↔ Output<
String?> -
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 (
YYYY-MM-DDTHH:MM:SSZ)latefinal -
description
↔ Output<
String?> -
Longer, human-readable description for the AMI.
latefinal
-
ebsBlockDevices
↔ Output<
List< AmiEbsBlockDevice> > -
Nested block describing an EBS block device that should be
attached to created instances. The structure of this block is described below.
latefinal
-
enaSupport
↔ Output<
bool?> -
Whether enhanced networking with ENA is enabled. Defaults to
false.latefinal -
ephemeralBlockDevices
↔ Output<
List< AmiEphemeralBlockDevice> > -
Nested block describing an ephemeral block device that
should be attached to created instances. The structure of this block is described below.
latefinal
- hashCode → int
-
The hash code for this object.
no setterinherited
-
hypervisor
↔ Output<
String> -
Hypervisor type of the image.
latefinal
-
id
↔ Output<
String> -
getter/setter pairinherited
-
imageLocation
↔ Output<
String> -
latefinal
-
imageOwnerAlias
↔ Output<
String> -
AWS account alias (for example, amazon, self) or the AWS account ID of the AMI owner.
latefinal
-
imageType
↔ Output<
String> -
Type of image.
latefinal
-
imdsSupport
↔ Output<
String?> -
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.latefinal - isCustom → bool
-
Returns whether this resource is provider-managed.
no setterinherited
- isProtected → bool
-
Returns whether this resource is protected from deletion.
no setterinherited
- isRemote → bool
-
Whether this resource is registered as remote.
no setterinherited
- isResourceReference → bool
-
Whether this instance represents a resource value returned over RPC.
finalinherited
-
kernelId
↔ Output<
String?> -
latefinal
-
lastLaunchedTime
↔ Output<
String> -
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.
latefinal
-
manageEbsSnapshots
↔ Output<
bool> -
latefinal
-
name
↔ Output<
String> -
Region-unique name for the AMI.
latefinal
-
ownerId
↔ Output<
String> -
AWS account ID of the image owner.
latefinal
-
platform
↔ Output<
String> -
This value is set to windows for Windows AMIs; otherwise, it is blank.
latefinal
-
platformDetails
↔ Output<
String> -
Platform details associated with the billing code of the AMI.
latefinal
-
public
↔ Output<
bool> -
Whether the image has public launch permissions.
latefinal
-
ramdiskId
↔ Output<
String?> -
latefinal
-
region
↔ Output<
String> -
Region where this resource will be managed. Defaults to the Region set in the provider configuration.
latefinal
-
resourceTransforms
→ List<
ResourceTransform> -
Inherited/explicit async transforms.
no setterinherited
-
rootDeviceName
↔ Output<
String?> -
Name of the root device (for example,
/dev/sda1, or/dev/xvda).latefinal -
rootSnapshotId
↔ Output<
String> -
Snapshot ID for the root volume (for EBS-backed AMIs)
latefinal
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
sriovNetSupport
↔ Output<
String?> -
latefinal
-
Map of tags to assign to the resource. If configured with a provider
defaultTagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level.latefinal -
Map of tags assigned to the resource, including those inherited from the provider
defaultTagsconfiguration block.latefinal -
tpmSupport
↔ Output<
String?> -
If the image is configured for NitroTPM support, the value is
v2.0. For more information, see NitroTPM in the EC2 User Guide.latefinal -
transformations
→ List<
ResourceTransformation> -
Inherited/explicit legacy transformations.
no setterinherited
-
uefiData
↔ Output<
String?> -
Base64 representation of the non-volatile UEFI variable store.
latefinal
-
urn
↔ Output<
String> -
latefinalinherited
-
usageOperation
↔ Output<
String> -
Operation of the Amazon EC2 instance and the billing code that is associated with the AMI.
latefinal
-
virtualizationType
↔ Output<
String?> -
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.
latefinal
Methods
-
failId(
Object error) → void -
Completes this resource ID with an error when registration fails.
inherited
-
failOutputs(
Object error) → void -
Completes all output properties with
error.inherited -
failUrn(
Object error) → void -
Completes this resource URN with an error when registration fails.
inherited
-
getProvider(
String moduleMember) → ProviderResource? -
Returns provider for
moduleMember's package, if configured.inherited -
getResourceName(
) → String -
Returns this resource's logical name.
inherited
-
getResourceType(
) → String -
Returns this resource's Pulumi type token.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerOutput<
T> (String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output< T> -
Registers a dynamic output property for this resource.
inherited
-
resolveId(
String? value, {required bool isKnown}) → void -
Resolves the provider-assigned ID for this resource.
inherited
-
resolveOutputs(
Struct outputs) → void -
Resolves all output properties from a monitor response payload.
inherited
-
resolveUrn(
String value) → void -
Resolves this resource's URN once assigned by the engine.
inherited
-
serializeProperties(
Map< String, dynamic> properties) → Future<Struct> -
Serializes resource properties for RPC transmission.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited