Ami

class Ami : KotlinCustomResource

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.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", {
name: "example",
virtualizationType: "hvm",
rootDeviceName: "/dev/xvda",
imdsSupport: "v2.0",
ebsBlockDevices: [{
deviceName: "/dev/xvda",
snapshotId: "snap-xxxxxxxx",
volumeSize: 8,
}],
});
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",
name="example",
virtualization_type="hvm",
root_device_name="/dev/xvda",
imds_support="v2.0",
ebs_block_devices=[{
"device_name": "/dev/xvda",
"snapshot_id": "snap-xxxxxxxx",
"volume_size": 8,
}])
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()
{
Name = "example",
VirtualizationType = "hvm",
RootDeviceName = "/dev/xvda",
ImdsSupport = "v2.0",
EbsBlockDevices = new[]
{
new Aws.Ec2.Inputs.AmiEbsBlockDeviceArgs
{
DeviceName = "/dev/xvda",
SnapshotId = "snap-xxxxxxxx",
VolumeSize = 8,
},
},
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v6/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{
Name: pulumi.String("example"),
VirtualizationType: pulumi.String("hvm"),
RootDeviceName: pulumi.String("/dev/xvda"),
ImdsSupport: pulumi.String("v2.0"),
EbsBlockDevices: ec2.AmiEbsBlockDeviceArray{
&ec2.AmiEbsBlockDeviceArgs{
DeviceName: pulumi.String("/dev/xvda"),
SnapshotId: pulumi.String("snap-xxxxxxxx"),
VolumeSize: pulumi.Int(8),
},
},
})
if err != nil {
return err
}
return nil
})
}
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.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) {
// 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()
.name("example")
.virtualizationType("hvm")
.rootDeviceName("/dev/xvda")
.imdsSupport("v2.0")
.ebsBlockDevices(AmiEbsBlockDeviceArgs.builder()
.deviceName("/dev/xvda")
.snapshotId("snap-xxxxxxxx")
.volumeSize(8)
.build())
.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:
name: example
virtualizationType: hvm
rootDeviceName: /dev/xvda
imdsSupport: v2.0
ebsBlockDevices:
- deviceName: /dev/xvda
snapshotId: snap-xxxxxxxx
volumeSize: 8

Import

Using pulumi import, import aws_ami using the ID of the AMI. For example:

$ pulumi import aws:ec2/ami:Ami example ami-12345678

Properties

Link copied to clipboard
val architecture: Output<String>?

Machine architecture for created instances. Defaults to x86_64.

Link copied to clipboard
val arn: Output<String>

ARN of the AMI.

Link copied to clipboard
val bootMode: Output<String>?

Boot mode of the AMI. For more information, see Boot modes in the Amazon Elastic Compute Cloud User Guide.

Link copied to clipboard
val 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)

Link copied to clipboard
val description: Output<String>?

Longer, human-readable description for the AMI.

Link copied to clipboard

Nested block describing an EBS block device that should be attached to created instances. The structure of this block is described below.

Link copied to clipboard
val enaSupport: Output<Boolean>?

Whether enhanced networking with ENA is enabled. Defaults to false.

Link copied to clipboard

Nested block describing an ephemeral block device that should be attached to created instances. The structure of this block is described below.

Link copied to clipboard
val hypervisor: Output<String>

Hypervisor type of the image.

Link copied to clipboard
val id: Output<String>
Link copied to clipboard
val imageLocation: Output<String>
Link copied to clipboard
val imageOwnerAlias: Output<String>

AWS account alias (for example, amazon, self) or the AWS account ID of the AMI owner.

Link copied to clipboard
val imageType: Output<String>

Type of image.

Link copied to clipboard
val 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.

Link copied to clipboard
val kernelId: Output<String>?
Link copied to clipboard

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.

Link copied to clipboard
Link copied to clipboard
val name: Output<String>

Region-unique name for the AMI.

Link copied to clipboard
val ownerId: Output<String>

AWS account ID of the image owner.

Link copied to clipboard
val platform: Output<String>

This value is set to windows for Windows AMIs; otherwise, it is blank.

Link copied to clipboard
val platformDetails: Output<String>

Platform details associated with the billing code of the AMI.

Link copied to clipboard
val public: Output<Boolean>

Whether the image has public launch permissions.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val ramdiskId: Output<String>?
Link copied to clipboard
val rootDeviceName: Output<String>?

Name of the root device (for example, /dev/sda1, or /dev/xvda).

Link copied to clipboard
val rootSnapshotId: Output<String>

Snapshot ID for the root volume (for EBS-backed AMIs)

Link copied to clipboard
val sriovNetSupport: Output<String>?
Link copied to clipboard
val tags: Output<Map<String, String>>?

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.

Link copied to clipboard
val tagsAll: Output<Map<String, String>>

Map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Link copied to clipboard
val tpmSupport: Output<String>?

If the image is configured for NitroTPM support, the value is v2.0. For more information, see NitroTPM in the Amazon Elastic Compute Cloud User Guide.

Link copied to clipboard
val uefiData: Output<String>?

Base64 representation of the non-volatile UEFI variable store.

Link copied to clipboard
val urn: Output<String>
Link copied to clipboard
val usageOperation: Output<String>

Operation of the Amazon EC2 instance and the billing code that is associated with the AMI.

Link copied to clipboard

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.