Instance class
Provides an EC2 instance resource. This allows instances to be created, updated, and deleted.
Example Usage
Basic example using AMI lookup
Using a data source
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const ubuntu = aws.ec2.getAmi({
filters: [
{
name: "name",
values: ["ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-amd64-server-*"],
},
{
name: "virtualization-type",
values: ["hvm"],
},
],
mostRecent: true,
owners: ["099720109477"],
});
const example = new aws.ec2.Instance("example", {
ami: ubuntu.then(ubuntu => ubuntu.id),
instanceType: aws.ec2.InstanceType.T3_Micro,
tags: {
Name: "HelloWorld",
},
});
import pulumi
import pulumi_aws as aws
ubuntu = aws.ec2.get_ami(filters=[
{
"name": "name",
"values": ["ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-amd64-server-*"],
},
{
"name": "virtualization-type",
"values": ["hvm"],
},
],
most_recent=True,
owners=["099720109477"])
example = aws.ec2.Instance("example",
ami=ubuntu.id,
instance_type=aws.ec2.InstanceType.T3_MICRO,
tags={
"Name": "HelloWorld",
})
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var ubuntu = Aws.Ec2.GetAmi.Invoke(new()
{
Filters = new[]
{
new Aws.Ec2.Inputs.GetAmiFilterInputArgs
{
Name = "name",
Values = new[]
{
"ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-amd64-server-*",
},
},
new Aws.Ec2.Inputs.GetAmiFilterInputArgs
{
Name = "virtualization-type",
Values = new[]
{
"hvm",
},
},
},
MostRecent = true,
Owners = new[]
{
"099720109477",
},
});
var example = new Aws.Ec2.Instance("example", new()
{
Ami = ubuntu.Apply(getAmiResult => getAmiResult.Id),
InstanceType = Aws.Ec2.InstanceType.T3_Micro,
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 {
ubuntu, err := ec2.LookupAmi(ctx, &ec2.LookupAmiArgs{
Filters: []ec2.GetAmiFilter{
{
Name: "name",
Values: []string{
"ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-amd64-server-*",
},
},
{
Name: "virtualization-type",
Values: []string{
"hvm",
},
},
},
MostRecent: pulumi.BoolRef(true),
Owners: []string{
"099720109477",
},
}, nil)
if err != nil {
return err
}
_, err = ec2.NewInstance(ctx, "example", &ec2.InstanceArgs{
Ami: pulumi.String(ubuntu.Id),
InstanceType: pulumi.String(ec2.InstanceType_T3_Micro),
Tags: pulumi.StringMap{
"Name": pulumi.String("HelloWorld"),
},
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
data "aws_ec2_getami" "ubuntu" {
filters {
name = "name"
values = ["ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-amd64-server-*"]
}
filters {
name = "virtualization-type"
values = ["hvm"]
}
most_recent = true
owners = ["099720109477"]
}
# Canonical
resource "aws_ec2_instance" "example" {
ami = data.aws_ec2_getami.ubuntu.id
instance_type = "t3.micro"
tags = {
"Name" = "HelloWorld"
}
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2.Ec2Functions;
import com.pulumi.aws.ec2.inputs.GetAmiArgs;
import com.pulumi.aws.ec2.inputs.GetAmiFilterArgs;
import com.pulumi.aws.ec2.Instance;
import com.pulumi.aws.ec2.InstanceArgs;
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) {
final var ubuntu = Ec2Functions.getAmi(GetAmiArgs.builder()
.filters(
GetAmiFilterArgs.builder()
.name("name")
.values("ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-amd64-server-*")
.build(),
GetAmiFilterArgs.builder()
.name("virtualization-type")
.values("hvm")
.build())
.mostRecent(true)
.owners("099720109477")
.build());
var example = new Instance("example", InstanceArgs.builder()
.ami(ubuntu.id())
.instanceType("t3.micro")
.tags(Map.of("Name", "HelloWorld"))
.build());
}
}
resources:
example:
type: aws:ec2:Instance
properties:
ami: ${ubuntu.id}
instanceType: t3.micro
tags:
Name: HelloWorld
variables:
ubuntu:
fn::invoke:
function: aws:ec2:getAmi
arguments:
filters:
- name: name
values:
- ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-amd64-server-*
- name: virtualization-type
values:
- hvm
mostRecent: true
owners:
- '099720109477'
Using AWS Systems Manager Parameter Store
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.ec2.Instance("example", {
ami: "resolve:ssm:/aws/service/ami-amazon-linux-latest/al2023-ami-kernel-default-x86_64",
instanceType: aws.ec2.InstanceType.T3_Micro,
tags: {
Name: "HelloWorld",
},
});
import pulumi
import pulumi_aws as aws
example = aws.ec2.Instance("example",
ami="resolve:ssm:/aws/service/ami-amazon-linux-latest/al2023-ami-kernel-default-x86_64",
instance_type=aws.ec2.InstanceType.T3_MICRO,
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.Instance("example", new()
{
Ami = "resolve:ssm:/aws/service/ami-amazon-linux-latest/al2023-ami-kernel-default-x86_64",
InstanceType = Aws.Ec2.InstanceType.T3_Micro,
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.NewInstance(ctx, "example", &ec2.InstanceArgs{
Ami: pulumi.String("resolve:ssm:/aws/service/ami-amazon-linux-latest/al2023-ami-kernel-default-x86_64"),
InstanceType: pulumi.String(ec2.InstanceType_T3_Micro),
Tags: pulumi.StringMap{
"Name": pulumi.String("HelloWorld"),
},
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_ec2_instance" "example" {
ami = "resolve:ssm:/aws/service/ami-amazon-linux-latest/al2023-ami-kernel-default-x86_64"
instance_type = "t3.micro"
tags = {
"Name" = "HelloWorld"
}
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2.Instance;
import com.pulumi.aws.ec2.InstanceArgs;
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 Instance("example", InstanceArgs.builder()
.ami("resolve:ssm:/aws/service/ami-amazon-linux-latest/al2023-ami-kernel-default-x86_64")
.instanceType("t3.micro")
.tags(Map.of("Name", "HelloWorld"))
.build());
}
}
resources:
example:
type: aws:ec2:Instance
properties:
ami: resolve:ssm:/aws/service/ami-amazon-linux-latest/al2023-ami-kernel-default-x86_64
instanceType: t3.micro
tags:
Name: HelloWorld
Spot instance example
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = aws.ec2.getAmi({
filters: [
{
name: "architecture",
values: ["arm64"],
},
{
name: "name",
values: ["al2023-ami-2023*"],
},
],
mostRecent: true,
owners: ["amazon"],
});
const exampleInstance = new aws.ec2.Instance("example", {
instanceMarketOptions: {
spotOptions: {
maxPrice: "0.0031",
},
marketType: "spot",
},
ami: example.then(example => example.id),
instanceType: aws.ec2.InstanceType.T4g_Nano,
tags: {
Name: "test-spot",
},
});
import pulumi
import pulumi_aws as aws
example = aws.ec2.get_ami(filters=[
{
"name": "architecture",
"values": ["arm64"],
},
{
"name": "name",
"values": ["al2023-ami-2023*"],
},
],
most_recent=True,
owners=["amazon"])
example_instance = aws.ec2.Instance("example",
instance_market_options={
"spot_options": {
"max_price": "0.0031",
},
"market_type": "spot",
},
ami=example.id,
instance_type=aws.ec2.InstanceType.T4G_NANO,
tags={
"Name": "test-spot",
})
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = Aws.Ec2.GetAmi.Invoke(new()
{
Filters = new[]
{
new Aws.Ec2.Inputs.GetAmiFilterInputArgs
{
Name = "architecture",
Values = new[]
{
"arm64",
},
},
new Aws.Ec2.Inputs.GetAmiFilterInputArgs
{
Name = "name",
Values = new[]
{
"al2023-ami-2023*",
},
},
},
MostRecent = true,
Owners = new[]
{
"amazon",
},
});
var exampleInstance = new Aws.Ec2.Instance("example", new()
{
InstanceMarketOptions = new Aws.Ec2.Inputs.InstanceInstanceMarketOptionsArgs
{
SpotOptions = new Aws.Ec2.Inputs.InstanceInstanceMarketOptionsSpotOptionsArgs
{
MaxPrice = "0.0031",
},
MarketType = "spot",
},
Ami = example.Apply(getAmiResult => getAmiResult.Id),
InstanceType = Aws.Ec2.InstanceType.T4g_Nano,
Tags =
{
{ "Name", "test-spot" },
},
});
});
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 {
example, err := ec2.LookupAmi(ctx, &ec2.LookupAmiArgs{
Filters: []ec2.GetAmiFilter{
{
Name: "architecture",
Values: []string{
"arm64",
},
},
{
Name: "name",
Values: []string{
"al2023-ami-2023*",
},
},
},
MostRecent: pulumi.BoolRef(true),
Owners: []string{
"amazon",
},
}, nil)
if err != nil {
return err
}
_, err = ec2.NewInstance(ctx, "example", &ec2.InstanceArgs{
InstanceMarketOptions: &ec2.InstanceInstanceMarketOptionsArgs{
SpotOptions: &ec2.InstanceInstanceMarketOptionsSpotOptionsArgs{
MaxPrice: pulumi.String("0.0031"),
},
MarketType: pulumi.String("spot"),
},
Ami: pulumi.String(example.Id),
InstanceType: pulumi.String(ec2.InstanceType_T4g_Nano),
Tags: pulumi.StringMap{
"Name": pulumi.String("test-spot"),
},
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
data "aws_ec2_getami" "example" {
filters {
name = "architecture"
values = ["arm64"]
}
filters {
name = "name"
values = ["al2023-ami-2023*"]
}
most_recent = true
owners = ["amazon"]
}
resource "aws_ec2_instance" "example" {
instance_market_options = {
spot_options = {
max_price = 0.0031
}
market_type = "spot"
}
ami = data.aws_ec2_getami.example.id
instance_type = "t4g.nano"
tags = {
"Name" = "test-spot"
}
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2.Ec2Functions;
import com.pulumi.aws.ec2.inputs.GetAmiArgs;
import com.pulumi.aws.ec2.inputs.GetAmiFilterArgs;
import com.pulumi.aws.ec2.Instance;
import com.pulumi.aws.ec2.InstanceArgs;
import com.pulumi.aws.ec2.inputs.InstanceInstanceMarketOptionsArgs;
import com.pulumi.aws.ec2.inputs.InstanceInstanceMarketOptionsSpotOptionsArgs;
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) {
final var example = Ec2Functions.getAmi(GetAmiArgs.builder()
.filters(
GetAmiFilterArgs.builder()
.name("architecture")
.values("arm64")
.build(),
GetAmiFilterArgs.builder()
.name("name")
.values("al2023-ami-2023*")
.build())
.mostRecent(true)
.owners("amazon")
.build());
var exampleInstance = new Instance("exampleInstance", InstanceArgs.builder()
.instanceMarketOptions(InstanceInstanceMarketOptionsArgs.builder()
.spotOptions(InstanceInstanceMarketOptionsSpotOptionsArgs.builder()
.maxPrice("0.0031")
.build())
.marketType("spot")
.build())
.ami(example.id())
.instanceType("t4g.nano")
.tags(Map.of("Name", "test-spot"))
.build());
}
}
resources:
exampleInstance:
type: aws:ec2:Instance
name: example
properties:
instanceMarketOptions:
spotOptions:
maxPrice: 0.0031
marketType: spot
ami: ${example.id}
instanceType: t4g.nano
tags:
Name: test-spot
variables:
example:
fn::invoke:
function: aws:ec2:getAmi
arguments:
filters:
- name: architecture
values:
- arm64
- name: name
values:
- al2023-ami-2023*
mostRecent: true
owners:
- amazon
Network and credit specification example
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const myVpc = new aws.ec2.Vpc("my_vpc", {
cidrBlock: "172.16.0.0/16",
tags: {
Name: "tf-example",
},
});
const mySubnet = new aws.ec2.Subnet("my_subnet", {
vpcId: myVpc.id,
cidrBlock: "172.16.10.0/24",
availabilityZone: "us-west-2a",
tags: {
Name: "tf-example",
},
});
const example = new aws.ec2.NetworkInterface("example", {
subnetId: mySubnet.id,
privateIps: ["172.16.10.100"],
tags: {
Name: "primary_network_interface",
},
});
const exampleInstance = new aws.ec2.Instance("example", {
primaryNetworkInterface: {
networkInterfaceId: example.id,
},
creditSpecification: {
cpuCredits: "unlimited",
},
ami: "ami-005e54dee72cc1d00",
instanceType: aws.ec2.InstanceType.T2_Micro,
});
import pulumi
import pulumi_aws as aws
my_vpc = aws.ec2.Vpc("my_vpc",
cidr_block="172.16.0.0/16",
tags={
"Name": "tf-example",
})
my_subnet = aws.ec2.Subnet("my_subnet",
vpc_id=my_vpc.id,
cidr_block="172.16.10.0/24",
availability_zone="us-west-2a",
tags={
"Name": "tf-example",
})
example = aws.ec2.NetworkInterface("example",
subnet_id=my_subnet.id,
private_ips=["172.16.10.100"],
tags={
"Name": "primary_network_interface",
})
example_instance = aws.ec2.Instance("example",
primary_network_interface={
"network_interface_id": example.id,
},
credit_specification={
"cpu_credits": "unlimited",
},
ami="ami-005e54dee72cc1d00",
instance_type=aws.ec2.InstanceType.T2_MICRO)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var myVpc = new Aws.Ec2.Vpc("my_vpc", new()
{
CidrBlock = "172.16.0.0/16",
Tags =
{
{ "Name", "tf-example" },
},
});
var mySubnet = new Aws.Ec2.Subnet("my_subnet", new()
{
VpcId = myVpc.Id,
CidrBlock = "172.16.10.0/24",
AvailabilityZone = "us-west-2a",
Tags =
{
{ "Name", "tf-example" },
},
});
var example = new Aws.Ec2.NetworkInterface("example", new()
{
SubnetId = mySubnet.Id,
PrivateIps = new[]
{
"172.16.10.100",
},
Tags =
{
{ "Name", "primary_network_interface" },
},
});
var exampleInstance = new Aws.Ec2.Instance("example", new()
{
PrimaryNetworkInterface = new Aws.Ec2.Inputs.InstancePrimaryNetworkInterfaceArgs
{
NetworkInterfaceId = example.Id,
},
CreditSpecification = new Aws.Ec2.Inputs.InstanceCreditSpecificationArgs
{
CpuCredits = "unlimited",
},
Ami = "ami-005e54dee72cc1d00",
InstanceType = Aws.Ec2.InstanceType.T2_Micro,
});
});
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 {
myVpc, err := ec2.NewVpc(ctx, "my_vpc", &ec2.VpcArgs{
CidrBlock: pulumi.String("172.16.0.0/16"),
Tags: pulumi.StringMap{
"Name": pulumi.String("tf-example"),
},
})
if err != nil {
return err
}
mySubnet, err := ec2.NewSubnet(ctx, "my_subnet", &ec2.SubnetArgs{
VpcId: myVpc.ID().ToIDOutput().ToStringOutput(),
CidrBlock: pulumi.String("172.16.10.0/24"),
AvailabilityZone: pulumi.String("us-west-2a"),
Tags: pulumi.StringMap{
"Name": pulumi.String("tf-example"),
},
})
if err != nil {
return err
}
example, err := ec2.NewNetworkInterface(ctx, "example", &ec2.NetworkInterfaceArgs{
SubnetId: mySubnet.ID().ToIDOutput().ToStringOutput(),
PrivateIps: pulumi.StringArray{
pulumi.String("172.16.10.100"),
},
Tags: pulumi.StringMap{
"Name": pulumi.String("primary_network_interface"),
},
})
if err != nil {
return err
}
_, err = ec2.NewInstance(ctx, "example", &ec2.InstanceArgs{
PrimaryNetworkInterface: &ec2.InstancePrimaryNetworkInterfaceArgs{
NetworkInterfaceId: example.ID().ToIDOutput().ToStringOutput(),
},
CreditSpecification: &ec2.InstanceCreditSpecificationArgs{
CpuCredits: pulumi.String("unlimited"),
},
Ami: pulumi.String("ami-005e54dee72cc1d00"),
InstanceType: pulumi.String(ec2.InstanceType_T2_Micro),
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_ec2_vpc" "my_vpc" {
cidr_block = "172.16.0.0/16"
tags = {
"Name" = "tf-example"
}
}
resource "aws_ec2_subnet" "my_subnet" {
vpc_id = aws_ec2_vpc.my_vpc.id
cidr_block = "172.16.10.0/24"
availability_zone = "us-west-2a"
tags = {
"Name" = "tf-example"
}
}
resource "aws_ec2_networkinterface" "example" {
subnet_id = aws_ec2_subnet.my_subnet.id
private_ips = ["172.16.10.100"]
tags = {
"Name" = "primary_network_interface"
}
}
resource "aws_ec2_instance" "example" {
primary_network_interface = {
network_interface_id = aws_ec2_networkinterface.example.id
}
credit_specification = {
cpu_credits = "unlimited"
}
ami = "ami-005e54dee72cc1d00"
instance_type = "t2.micro"
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2.Vpc;
import com.pulumi.aws.ec2.VpcArgs;
import com.pulumi.aws.ec2.Subnet;
import com.pulumi.aws.ec2.SubnetArgs;
import com.pulumi.aws.ec2.NetworkInterface;
import com.pulumi.aws.ec2.NetworkInterfaceArgs;
import com.pulumi.aws.ec2.Instance;
import com.pulumi.aws.ec2.InstanceArgs;
import com.pulumi.aws.ec2.inputs.InstancePrimaryNetworkInterfaceArgs;
import com.pulumi.aws.ec2.inputs.InstanceCreditSpecificationArgs;
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 myVpc = new Vpc("myVpc", VpcArgs.builder()
.cidrBlock("172.16.0.0/16")
.tags(Map.of("Name", "tf-example"))
.build());
var mySubnet = new Subnet("mySubnet", SubnetArgs.builder()
.vpcId(myVpc.id())
.cidrBlock("172.16.10.0/24")
.availabilityZone("us-west-2a")
.tags(Map.of("Name", "tf-example"))
.build());
var example = new NetworkInterface("example", NetworkInterfaceArgs.builder()
.subnetId(mySubnet.id())
.privateIps("172.16.10.100")
.tags(Map.of("Name", "primary_network_interface"))
.build());
var exampleInstance = new Instance("exampleInstance", InstanceArgs.builder()
.primaryNetworkInterface(InstancePrimaryNetworkInterfaceArgs.builder()
.networkInterfaceId(example.id())
.build())
.creditSpecification(InstanceCreditSpecificationArgs.builder()
.cpuCredits("unlimited")
.build())
.ami("ami-005e54dee72cc1d00")
.instanceType("t2.micro")
.build());
}
}
resources:
myVpc:
type: aws:ec2:Vpc
name: my_vpc
properties:
cidrBlock: 172.16.0.0/16
tags:
Name: tf-example
mySubnet:
type: aws:ec2:Subnet
name: my_subnet
properties:
vpcId: ${myVpc.id}
cidrBlock: 172.16.10.0/24
availabilityZone: us-west-2a
tags:
Name: tf-example
example:
type: aws:ec2:NetworkInterface
properties:
subnetId: ${mySubnet.id}
privateIps:
- 172.16.10.100
tags:
Name: primary_network_interface
exampleInstance:
type: aws:ec2:Instance
name: example
properties:
primaryNetworkInterface:
networkInterfaceId: ${example.id}
creditSpecification:
cpuCredits: unlimited
ami: ami-005e54dee72cc1d00
instanceType: t2.micro
CPU options example
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.ec2.Vpc("example", {
cidrBlock: "172.16.0.0/16",
tags: {
Name: "tf-example",
},
});
const exampleSubnet = new aws.ec2.Subnet("example", {
vpcId: example.id,
cidrBlock: "172.16.10.0/24",
availabilityZone: "us-east-2a",
tags: {
Name: "tf-example",
},
});
const amzn_linux_2023_ami = aws.ec2.getAmi({
filters: [{
name: "name",
values: ["al2023-ami-2023.*-x86_64"],
}],
mostRecent: true,
owners: ["amazon"],
});
const exampleInstance = new aws.ec2.Instance("example", {
cpuOptions: {
coreCount: 2,
threadsPerCore: 2,
},
ami: amzn_linux_2023_ami.then(amzn_linux_2023_ami => amzn_linux_2023_ami.id),
instanceType: aws.ec2.InstanceType.C6a_2XLarge,
subnetId: exampleSubnet.id,
tags: {
Name: "tf-example",
},
});
import pulumi
import pulumi_aws as aws
example = aws.ec2.Vpc("example",
cidr_block="172.16.0.0/16",
tags={
"Name": "tf-example",
})
example_subnet = aws.ec2.Subnet("example",
vpc_id=example.id,
cidr_block="172.16.10.0/24",
availability_zone="us-east-2a",
tags={
"Name": "tf-example",
})
amzn_linux_2023_ami = aws.ec2.get_ami(filters=[{
"name": "name",
"values": ["al2023-ami-2023.*-x86_64"],
}],
most_recent=True,
owners=["amazon"])
example_instance = aws.ec2.Instance("example",
cpu_options={
"core_count": 2,
"threads_per_core": 2,
},
ami=amzn_linux_2023_ami.id,
instance_type=aws.ec2.InstanceType.C6A_2_X_LARGE,
subnet_id=example_subnet.id,
tags={
"Name": "tf-example",
})
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.Ec2.Vpc("example", new()
{
CidrBlock = "172.16.0.0/16",
Tags =
{
{ "Name", "tf-example" },
},
});
var exampleSubnet = new Aws.Ec2.Subnet("example", new()
{
VpcId = example.Id,
CidrBlock = "172.16.10.0/24",
AvailabilityZone = "us-east-2a",
Tags =
{
{ "Name", "tf-example" },
},
});
var amzn_linux_2023_ami = Aws.Ec2.GetAmi.Invoke(new()
{
Filters = new[]
{
new Aws.Ec2.Inputs.GetAmiFilterInputArgs
{
Name = "name",
Values = new[]
{
"al2023-ami-2023.*-x86_64",
},
},
},
MostRecent = true,
Owners = new[]
{
"amazon",
},
});
var exampleInstance = new Aws.Ec2.Instance("example", new()
{
CpuOptions = new Aws.Ec2.Inputs.InstanceCpuOptionsArgs
{
CoreCount = 2,
ThreadsPerCore = 2,
},
Ami = amzn_linux_2023_ami.Apply(amzn_linux_2023_ami => amzn_linux_2023_ami.Apply(getAmiResult => getAmiResult.Id)),
InstanceType = Aws.Ec2.InstanceType.C6a_2XLarge,
SubnetId = exampleSubnet.Id,
Tags =
{
{ "Name", "tf-example" },
},
});
});
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 {
example, err := ec2.NewVpc(ctx, "example", &ec2.VpcArgs{
CidrBlock: pulumi.String("172.16.0.0/16"),
Tags: pulumi.StringMap{
"Name": pulumi.String("tf-example"),
},
})
if err != nil {
return err
}
exampleSubnet, err := ec2.NewSubnet(ctx, "example", &ec2.SubnetArgs{
VpcId: example.ID().ToIDOutput().ToStringOutput(),
CidrBlock: pulumi.String("172.16.10.0/24"),
AvailabilityZone: pulumi.String("us-east-2a"),
Tags: pulumi.StringMap{
"Name": pulumi.String("tf-example"),
},
})
if err != nil {
return err
}
amzn_linux_2023_ami, err := ec2.LookupAmi(ctx, &ec2.LookupAmiArgs{
Filters: []ec2.GetAmiFilter{
{
Name: "name",
Values: []string{
"al2023-ami-2023.*-x86_64",
},
},
},
MostRecent: pulumi.BoolRef(true),
Owners: []string{
"amazon",
},
}, nil)
if err != nil {
return err
}
_, err = ec2.NewInstance(ctx, "example", &ec2.InstanceArgs{
CpuOptions: &ec2.InstanceCpuOptionsArgs{
CoreCount: pulumi.Int(2),
ThreadsPerCore: pulumi.Int(2),
},
Ami: pulumi.String(amzn_linux_2023_ami.Id),
InstanceType: pulumi.String(ec2.InstanceType_C6a_2XLarge),
SubnetId: exampleSubnet.ID().ToIDOutput().ToStringOutput(),
Tags: pulumi.StringMap{
"Name": pulumi.String("tf-example"),
},
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
data "aws_ec2_getami" "amzn-linux-2023-ami" {
filters {
name = "name"
values = ["al2023-ami-2023.*-x86_64"]
}
most_recent = true
owners = ["amazon"]
}
resource "aws_ec2_vpc" "example" {
cidr_block = "172.16.0.0/16"
tags = {
"Name" = "tf-example"
}
}
resource "aws_ec2_subnet" "example" {
vpc_id = aws_ec2_vpc.example.id
cidr_block = "172.16.10.0/24"
availability_zone = "us-east-2a"
tags = {
"Name" = "tf-example"
}
}
resource "aws_ec2_instance" "example" {
cpu_options = {
core_count = 2
threads_per_core = 2
}
ami = data.aws_ec2_getami.amzn-linux-2023-ami.id
instance_type = "c6a.2xlarge"
subnet_id = aws_ec2_subnet.example.id
tags = {
"Name" = "tf-example"
}
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2.Vpc;
import com.pulumi.aws.ec2.VpcArgs;
import com.pulumi.aws.ec2.Subnet;
import com.pulumi.aws.ec2.SubnetArgs;
import com.pulumi.aws.ec2.Ec2Functions;
import com.pulumi.aws.ec2.inputs.GetAmiArgs;
import com.pulumi.aws.ec2.inputs.GetAmiFilterArgs;
import com.pulumi.aws.ec2.Instance;
import com.pulumi.aws.ec2.InstanceArgs;
import com.pulumi.aws.ec2.inputs.InstanceCpuOptionsArgs;
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 Vpc("example", VpcArgs.builder()
.cidrBlock("172.16.0.0/16")
.tags(Map.of("Name", "tf-example"))
.build());
var exampleSubnet = new Subnet("exampleSubnet", SubnetArgs.builder()
.vpcId(example.id())
.cidrBlock("172.16.10.0/24")
.availabilityZone("us-east-2a")
.tags(Map.of("Name", "tf-example"))
.build());
final var amzn-linux-2023-ami = Ec2Functions.getAmi(GetAmiArgs.builder()
.filters(GetAmiFilterArgs.builder()
.name("name")
.values("al2023-ami-2023.*-x86_64")
.build())
.mostRecent(true)
.owners("amazon")
.build());
var exampleInstance = new Instance("exampleInstance", InstanceArgs.builder()
.cpuOptions(InstanceCpuOptionsArgs.builder()
.coreCount(2)
.threadsPerCore(2)
.build())
.ami(amzn_linux_2023_ami.id())
.instanceType("c6a.2xlarge")
.subnetId(exampleSubnet.id())
.tags(Map.of("Name", "tf-example"))
.build());
}
}
resources:
example:
type: aws:ec2:Vpc
properties:
cidrBlock: 172.16.0.0/16
tags:
Name: tf-example
exampleSubnet:
type: aws:ec2:Subnet
name: example
properties:
vpcId: ${example.id}
cidrBlock: 172.16.10.0/24
availabilityZone: us-east-2a
tags:
Name: tf-example
exampleInstance:
type: aws:ec2:Instance
name: example
properties:
cpuOptions:
coreCount: 2
threadsPerCore: 2
ami: ${["amzn-linux-2023-ami"].id}
instanceType: c6a.2xlarge
subnetId: ${exampleSubnet.id}
tags:
Name: tf-example
variables:
amzn-linux-2023-ami:
fn::invoke:
function: aws:ec2:getAmi
arguments:
filters:
- name: name
values:
- al2023-ami-2023.*-x86_64
mostRecent: true
owners:
- amazon
Host resource group or License Manager registered AMI example
A host resource group is a collection of Dedicated Hosts that you can manage as a single entity. As you launch instances, License Manager allocates the hosts and launches instances on them based on the settings that you configured. You can add existing Dedicated Hosts to a host resource group and take advantage of automated host management through License Manager.
> NOTE: A dedicated host is automatically associated with a License Manager host resource group if Allocate hosts automatically is enabled. Otherwise, use the hostResourceGroupArn argument to explicitly associate the instance with the host resource group.
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const _this = new aws.ec2.Instance("this", {
ami: "ami-0dcc1e21636832c5d",
instanceType: aws.ec2.InstanceType.M5_Large,
hostResourceGroupArn: "arn:aws:resource-groups:us-west-2:123456789012:group/win-testhost",
tenancy: "host",
});
import pulumi
import pulumi_aws as aws
this = aws.ec2.Instance("this",
ami="ami-0dcc1e21636832c5d",
instance_type=aws.ec2.InstanceType.M5_LARGE,
host_resource_group_arn="arn:aws:resource-groups:us-west-2:123456789012:group/win-testhost",
tenancy="host")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var @this = new Aws.Ec2.Instance("this", new()
{
Ami = "ami-0dcc1e21636832c5d",
InstanceType = Aws.Ec2.InstanceType.M5_Large,
HostResourceGroupArn = "arn:aws:resource-groups:us-west-2:123456789012:group/win-testhost",
Tenancy = "host",
});
});
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.NewInstance(ctx, "this", &ec2.InstanceArgs{
Ami: pulumi.String("ami-0dcc1e21636832c5d"),
InstanceType: pulumi.String(ec2.InstanceType_M5_Large),
HostResourceGroupArn: pulumi.String("arn:aws:resource-groups:us-west-2:123456789012:group/win-testhost"),
Tenancy: pulumi.String("host"),
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_ec2_instance" "this" {
ami = "ami-0dcc1e21636832c5d"
instance_type = "m5.large"
host_resource_group_arn = "arn:aws:resource-groups:us-west-2:123456789012:group/win-testhost"
tenancy = "host"
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2.Instance;
import com.pulumi.aws.ec2.InstanceArgs;
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 this_ = new Instance("this", InstanceArgs.builder()
.ami("ami-0dcc1e21636832c5d")
.instanceType("m5.large")
.hostResourceGroupArn("arn:aws:resource-groups:us-west-2:123456789012:group/win-testhost")
.tenancy("host")
.build());
}
}
resources:
this:
type: aws:ec2:Instance
properties:
ami: ami-0dcc1e21636832c5d
instanceType: m5.large
hostResourceGroupArn: arn:aws:resource-groups:us-west-2:123456789012:group/win-testhost
tenancy: host
> Note: There are five types of tags relevant to an aws.ec2.Instance: (1) instance tags — applied to instances but not to ebsBlockDevice or rootBlockDevice volumes; (2) default tags — applied to the instance and to those volumes; (3) volume tags — applied during creation to ebsBlockDevice and rootBlockDevice volumes; (4) root block device tags — applied only to the rootBlockDevice volume (conflicts with volumeTags); (5) EBS block device tags — applied only to the specific ebsBlockDevice volume and cannot be updated (conflicts with volumeTags). Do not use volumeTags if you manage block device tags outside the aws.ec2.Instance configuration (e.g., using tags in an aws.ebs.Volume resource) as this causes resource cycling and inconsistent behavior.
Import
Identity Schema
Required
id- (String) ID of the instance.
Optional
accountId(String) AWS Account where this resource is managed.region(String) Region where this resource is managed.
Using pulumi import, import instances using the id. For example:
$ pulumi import aws:ec2/instance:Instance web i-12345678
Constructors
- Instance(String name, {InstanceArgs? args, CustomResourceOptions? options})
-
Creates a new Instance.
nameThe Pulumi resource name.argsArguments used to configure this Instance. The set of arguments for Instance.optionsResource options controlling this resource's behavior. - Instance.reference(String urn)
- Creates a typed reference to an existing Instance resource.
Properties
-
ami
↔ Output<
String> -
AMI to use for the instance. Required unless
launchTemplateis specified and the Launch Template specifes an AMI. If an AMI is specified in the Launch Template, settingamiwill override the AMI specified in the Launch Template.latefinal -
arn
↔ Output<
String> -
ARN of the instance.
latefinal
-
associatePublicIpAddress
↔ Output<
bool> -
Whether to associate a public IP address with an instance in a VPC.
latefinal
-
availabilityZone
↔ Output<
String> -
AZ to start the instance in.
latefinal
-
capacityReservationSpecification
↔ Output<
InstanceCapacityReservationSpecification> -
Describes an instance's Capacity Reservation targeting option. See Capacity Reservation Specification below for more details.
latefinal
-
childResources
→ Set<
Resource> -
finalinherited
-
completionSources
↔ Map<
String, IOutputCompletionSource> -
latefinalinherited
-
cpuOptions
↔ Output<
InstanceCpuOptions> -
The CPU options for the instance. See CPU Options below for more details.
latefinal
-
creditSpecification
↔ Output<
InstanceCreditSpecification?> -
Configuration block for customizing the credit specification of the instance. See Credit Specification below for more details. This provider will only perform drift detection of its value when present in a configuration. Removing this configuration on existing instances will only stop managing it. It will not change the configuration back to the default for the instance type.
latefinal
-
disableApiStop
↔ Output<
bool> -
If true, enables EC2 Instance Stop Protection.
latefinal
-
disableApiTermination
↔ Output<
bool> -
If true, enables EC2 Instance Termination Protection.
latefinal
-
ebsBlockDevices
↔ Output<
List< InstanceEbsBlockDevice> > -
One or more configuration blocks with additional EBS block devices to attach to the instance. Block device configurations only apply on resource creation. See Block Devices below for details on attributes and drift detection. When accessing this as an attribute reference, it is a set of objects.
latefinal
-
ebsOptimized
↔ Output<
bool> -
If true, the launched EC2 instance will be EBS-optimized. Note that if this is not set on an instance type that is optimized by default then this will show as disabled but if the instance type is optimized by default then there is no need to set this and there is no effect to disabling it. See the EBS Optimized section of the AWS User Guide for more information.
latefinal
-
enablePrimaryIpv6
↔ Output<
bool> -
Whether to assign a primary IPv6 Global Unicast Address (GUA) to the instance when launched in a dual-stack or IPv6-only subnet. A primary IPv6 address ensures a consistent IPv6 address for the instance and is automatically assigned by AWS to the ENI. Once enabled, the first IPv6 GUA becomes the primary IPv6 address and cannot be disabled. The primary IPv6 address remains until the instance is terminated or the ENI is detached. Disabling
enablePrimaryIpv6after it has been enabled forces recreation of the instance.latefinal -
enclaveOptions
↔ Output<
InstanceEnclaveOptions> -
Enable Nitro Enclaves on launched instances. See Enclave Options below for more details.
latefinal
-
ephemeralBlockDevices
↔ Output<
List< InstanceEphemeralBlockDevice> > -
One or more configuration blocks to customize Ephemeral (also known as "Instance Store") volumes on the instance. See Block Devices below for details. When accessing this as an attribute reference, it is a set of objects.
latefinal
-
forceDestroy
↔ Output<
bool?> -
Destroys instance even if
disableApiTerminationordisableApiStopis set totrue. Defaults tofalse. Once this parameter is set totrue, a successfulpulumi uprun before a destroy is required to update this value in the resource state. Without a successfulpulumi upafter this parameter is set, this flag will have no effect. If setting this field in the same operation that would require replacing the instance or destroying the instance, this flag will not work. Additionally when importing an instance, a successfulpulumi upis required to set this value in state before it will take effect on a destroy operation.latefinal -
getPasswordData
↔ Output<
bool?> -
If true, wait for password data to become available and retrieve it. Useful for getting the administrator password for instances running Microsoft Windows. The password data is exported to the
passwordDataattribute. See GetPasswordData for more information.latefinal - hashCode → int
-
The hash code for this object.
no setterinherited
-
hibernation
↔ Output<
bool?> -
If true, the launched EC2 instance will support hibernation.
latefinal
-
hostId
↔ Output<
String> -
ID of a dedicated host that the instance will be assigned to. Use when an instance is to be launched on a specific dedicated host.
latefinal
-
hostResourceGroupArn
↔ Output<
String> -
ARN of the host resource group in which to launch the instances. If you specify an ARN, omit the
tenancyparameter or set it tohost.latefinal -
iamInstanceProfile
↔ Output<
String> -
IAM Instance Profile to launch the instance with. Specified as the name of the Instance Profile. Ensure your credentials have the correct permission to assign the instance profile according to the EC2 documentation, notably
iam:PassRole.latefinal -
id
↔ Output<
String> -
getter/setter pairinherited
-
instanceInitiatedShutdownBehavior
↔ Output<
String> -
Shutdown behavior for the instance. Amazon defaults this to
stopfor EBS-backed instances andterminatefor instance-store instances. Cannot be set on instance-store instances. See Shutdown Behavior for more information.latefinal -
instanceLifecycle
↔ Output<
String> -
Indicates whether this is a Spot Instance or a Scheduled Instance.
latefinal
-
instanceMarketOptions
↔ Output<
InstanceInstanceMarketOptions> -
Describes the market (purchasing) option for the instances. See Market Options below for details on attributes.
latefinal
-
instanceState
↔ Output<
String> -
State of the instance. One of:
pending,running,shutting-down,terminated,stopping,stopped. See Instance Lifecycle for more information.latefinal -
instanceType
↔ Output<
String> -
Instance type to use for the instance. Required unless
launchTemplateis specified and the Launch Template specifies an instance type. If an instance type is specified in the Launch Template, settinginstanceTypewill override the instance type specified in the Launch Template. Updates to this field will trigger a stop/start of the EC2 instance.latefinal -
ipv6AddressCount
↔ Output<
int> -
Number of IPv6 addresses to associate with the primary network interface. Amazon EC2 chooses the IPv6 addresses from the range of your subnet.
latefinal
-
ipv6Addresses
↔ Output<
List< String> > -
Specify one or more IPv6 addresses from the range of the subnet to associate with the primary network interface
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
-
keyName
↔ Output<
String> -
Key name of the Key Pair to use for the instance; which can be managed using the
aws.ec2.KeyPairresource.latefinal -
launchTemplate
↔ Output<
InstanceLaunchTemplate?> -
Specifies a Launch Template to configure the instance. Parameters configured on this resource will override the corresponding parameters in the Launch Template. See Launch Template Specification below for more details.
latefinal
-
maintenanceOptions
↔ Output<
InstanceMaintenanceOptions> -
Maintenance and recovery options for the instance. See Maintenance Options below for more details.
latefinal
-
metadataOptions
↔ Output<
InstanceMetadataOptions> -
Customize the metadata options of the instance. See Metadata Options below for more details.
latefinal
-
monitoring
↔ Output<
bool> -
If true, the launched EC2 instance will have detailed monitoring enabled. (Available since v0.6.0)
latefinal
-
networkInterfaces
↔ Output<
List< InstanceNetworkInterface> > -
Customize network interfaces to be attached at instance boot time. See Network Interfaces below for more details.
latefinal
-
outpostArn
↔ Output<
String> -
ARN of the Outpost the instance is assigned to.
latefinal
-
passwordData
↔ Output<
String> -
Base-64 encoded encrypted password data for the instance. Useful for getting the administrator password for instances running Microsoft Windows. This attribute is only exported if
getPasswordDatais true. Note that this encrypted value will be stored in the state file, as with all exported attributes. See GetPasswordData for more information.latefinal -
placementGroup
↔ Output<
String> -
Placement Group to start the instance in. Conflicts with
placementGroupId.latefinal -
placementGroupId
↔ Output<
String> -
Placement Group ID to start the instance in. Conflicts with
placementGroup.latefinal -
placementPartitionNumber
↔ Output<
int> -
Number of the partition the instance is in. Valid only if the
aws.ec2.PlacementGroupresource'sstrategyargument is set to"partition".latefinal -
primaryNetworkInterface
↔ Output<
InstancePrimaryNetworkInterface> -
The primary network interface. See Primary Network Interface below.
latefinal
-
primaryNetworkInterfaceId
↔ Output<
String> -
ID of the instance's primary network interface.
latefinal
-
privateDns
↔ Output<
String> -
Private DNS name assigned to the instance. Can only be used inside the Amazon EC2, and only available if you've enabled DNS hostnames for your VPC.
latefinal
-
privateDnsNameOptions
↔ Output<
InstancePrivateDnsNameOptions> -
Options for the instance hostname. The default values are inherited from the subnet. See Private DNS Name Options below for more details.
latefinal
-
privateIp
↔ Output<
String> -
Private IP address to associate with the instance in a VPC.
latefinal
-
publicDns
↔ Output<
String> -
Public DNS name assigned to the instance. For EC2-VPC, this is only available if you've enabled DNS hostnames for your VPC.
latefinal
-
publicIp
↔ Output<
String> -
Public IP address assigned to the instance, if applicable. NOTE: If you are using an
aws.ec2.Eipwith your instance, you should refer to the EIP's address directly and not usepublicIpas this field will change after the EIP is attached.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
-
rootBlockDevice
↔ Output<
InstanceRootBlockDevice> -
Configuration block to customize details about the root block device of the instance. See Block Devices below for details. When accessing this as an attribute reference, it is a list containing one object.
latefinal
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
secondaryNetworkInterfaces
↔ Output<
List< InstanceSecondaryNetworkInterface> > -
One or more secondary network interfaces to attach to the instance at launch time. See Secondary Network Interface below for more details.
latefinal
-
secondaryPrivateIps
↔ Output<
List< String> > -
List of secondary private IPv4 addresses to assign to the instance's primary network interface (eth0) in a VPC. Can only be assigned to the primary network interface (eth0) attached at instance creation, not a pre-existing network interface i.e., referenced in a
networkInterfaceblock. Refer to the Elastic network interfaces documentation to see the maximum number of private IP addresses allowed per instance type.latefinal -
securityGroups
↔ Output<
List< String> > -
List of security group names to associate with.
latefinal
-
sourceDestCheck
↔ Output<
bool?> -
Controls if traffic is routed to the instance when the destination address does not match the instance. Used for NAT or VPNs. Defaults true.
latefinal
-
spotInstanceRequestId
↔ Output<
String> -
If the request is a Spot Instance request, the ID of the request.
latefinal
-
subnetId
↔ Output<
String> -
VPC Subnet ID to launch in.
latefinal
-
Map of tags to assign to the resource. Note that these tags apply to the instance and not block storage devices. 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 -
tenancy
↔ Output<
String> -
Tenancy of the instance (if the instance is running in a VPC). An instance with a tenancy of
dedicatedruns on single-tenant hardware. Thehosttenancy is not supported for the import-instance command. Valid values aredefault,dedicated, andhost.latefinal -
transformations
→ List<
ResourceTransformation> -
Inherited/explicit legacy transformations.
no setterinherited
-
urn
↔ Output<
String> -
latefinalinherited
-
userData
↔ Output<
String?> -
User data to provide when launching the instance. Do not pass gzip-compressed data via this argument; see
userDataBase64instead. Updates to this field will trigger a stop/start of the EC2 instance by default. If theuserDataReplaceOnChangeis set then updates to this field will trigger a destroy and recreate of the EC2 instance.latefinal -
userDataBase64
↔ Output<
String> -
Can be used instead of
userDatato pass base64-encoded binary data directly. Use this instead ofuserDatawhenever the value is not a valid UTF-8 string. For example, gzip-encoded user data must be base64-encoded and passed via this argument to avoid corruption. Updates to this field will trigger a stop/start of the EC2 instance by default. If theuserDataReplaceOnChangeis set then updates to this field will trigger a destroy and recreate of the EC2 instance.latefinal -
userDataReplaceOnChange
↔ Output<
bool?> -
When used in combination with
userDataoruserDataBase64will trigger a destroy and recreate of the EC2 instance when set totrue. Defaults tofalseif not set.latefinal -
volumeTags
↔ Output<
Map< String, String> ?> -
Map of tags to assign, at instance-creation time, to root and EBS volumes.
latefinal
-
vpcSecurityGroupIds
↔ Output<
List< String> > -
List of security group IDs to associate with.
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