AmiCopy class
The "AMI copy" resource allows duplication of an AMI, including cross-region copies.
If the source AMI has associated EBS snapshots, those will also be duplicated along with the AMI.
This is useful for taking a single AMI provisioned in one region and making it available in another for a multi-region deployment.
Copying an AMI can take several minutes. The creation of this resource will block until the new AMI is available for use on new instances.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.ec2.AmiCopy("example", {
name: "example",
sourceAmiId: "ami-xxxxxxxx",
sourceAmiRegion: "us-west-1",
tags: {
Name: "HelloWorld",
},
});
import pulumi
import pulumi_aws as aws
example = aws.ec2.AmiCopy("example",
name="example",
source_ami_id="ami-xxxxxxxx",
source_ami_region="us-west-1",
tags={
"Name": "HelloWorld",
})
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.Ec2.AmiCopy("example", new()
{
Name = "example",
SourceAmiId = "ami-xxxxxxxx",
SourceAmiRegion = "us-west-1",
Tags =
{
{ "Name", "HelloWorld" },
},
});
});
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 {
_, err := ec2.NewAmiCopy(ctx, "example", &ec2.AmiCopyArgs{
Name: pulumi.String("example"),
SourceAmiId: pulumi.String("ami-xxxxxxxx"),
SourceAmiRegion: pulumi.String("us-west-1"),
Tags: pulumi.StringMap{
"Name": pulumi.String("HelloWorld"),
},
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_ec2_amicopy" "example" {
name = "example"
source_ami_id = "ami-xxxxxxxx"
source_ami_region = "us-west-1"
tags = {
"Name" = "HelloWorld"
}
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2.AmiCopy;
import com.pulumi.aws.ec2.AmiCopyArgs;
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) {
var example = new AmiCopy("example", AmiCopyArgs.builder()
.name("example")
.sourceAmiId("ami-xxxxxxxx")
.sourceAmiRegion("us-west-1")
.tags(Map.of("Name", "HelloWorld"))
.build());
}
}
resources:
example:
type: aws:ec2:AmiCopy
properties:
name: example
sourceAmiId: ami-xxxxxxxx
sourceAmiRegion: us-west-1
tags:
Name: HelloWorld
Constructors
- AmiCopy(String name, {AmiCopyArgs? args, CustomResourceOptions? options})
-
Creates a new AmiCopy.
nameThe Pulumi resource name.argsArguments used to configure this AmiCopy. The set of arguments for AmiCopy.optionsResource options controlling this resource's behavior. - AmiCopy.reference(String urn)
- Creates a typed reference to an existing AmiCopy 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
-
destinationOutpostArn
↔ Output<
String?> -
ARN of the Outpost to which to copy the AMI.
Only specify this parameter when copying an AMI from an AWS Region to an Outpost. The AMI must be in the Region of the destination Outpost.
latefinal
-
ebsBlockDevices
↔ Output<
List< AmiCopyEbsBlockDevice> > -
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 -
encrypted
↔ Output<
bool?> -
Whether the destination snapshots of the copied image should be encrypted. Defaults to
falselatefinal -
ephemeralBlockDevices
↔ Output<
List< AmiCopyEphemeralBlockDevice> > -
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> -
latefinal
-
id
↔ Output<
String> -
getter/setter pairinherited
-
imageLocation
↔ Output<
String> -
Path to an S3 object containing an image manifest, e.g., created
by the
ec2-upload-bundlecommand in the EC2 command line tools.latefinal -
imageOwnerAlias
↔ Output<
String> -
latefinal
-
imageType
↔ Output<
String> -
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> -
ID of the kernel image (AKI) that will be used as the paravirtual
kernel in created instances.
latefinal
-
kmsKeyId
↔ Output<
String> -
Full ARN of the KMS Key to use when encrypting the snapshots of an image during a copy operation. If not specified, then the default AWS KMS Key will be used
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> -
latefinal
-
platform
↔ Output<
String> -
latefinal
-
platformDetails
↔ Output<
String> -
latefinal
-
public
↔ Output<
bool> -
latefinal
-
ramdiskId
↔ Output<
String> -
ID of an initrd image (ARI) that will be used when booting the
created instances.
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> -
latefinal
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
sourceAmiId
↔ Output<
String> -
Id of the AMI to copy. This id must be valid in the region
given by
sourceAmiRegion.latefinal -
sourceAmiRegion
↔ Output<
String> -
Region from which the AMI will be copied. This may be the
same as the AWS provider region in order to create a copy within the same region.
latefinal
-
sriovNetSupport
↔ Output<
String> -
When set to "simple" (the default), enables enhanced networking
for created instances. No other value is supported at this time.
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 -
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> -
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