Instance
Provides an EC2 instance resource. This allows instances to be created, updated, and deleted.
Example Usage
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var ubuntu = Output.Create(Aws.GetAmi.InvokeAsync(new Aws.GetAmiArgs
{
Filters =
{
new Aws.Inputs.GetAmiFilterArgs
{
Name = "name",
Values =
{
"ubuntu/images/hvm-ssd/ubuntu-trusty-14.04-amd64-server-*",
},
},
new Aws.Inputs.GetAmiFilterArgs
{
Name = "virtualization-type",
Values =
{
"hvm",
},
},
},
MostRecent = true,
Owners =
{
"099720109477",
},
}));
var web = new Aws.Ec2.Instance("web", new Aws.Ec2.InstanceArgs
{
Ami = ubuntu.Apply(ubuntu => ubuntu.Id),
InstanceType = "t2.micro",
Tags =
{
{ "Name", "HelloWorld" },
},
});
}
}
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v2/go/aws"
"github.com/pulumi/pulumi-aws/sdk/v2/go/aws/ec2"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
opt0 := true
ubuntu, err := aws.GetAmi(ctx, &aws.GetAmiArgs{
Filters: []aws.GetAmiFilter{
aws.GetAmiFilter{
Name: "name",
Values: []string{
"ubuntu/images/hvm-ssd/ubuntu-trusty-14.04-amd64-server-*",
},
},
aws.GetAmiFilter{
Name: "virtualization-type",
Values: []string{
"hvm",
},
},
},
MostRecent: &opt0,
Owners: []string{
"099720109477",
},
}, nil)
if err != nil {
return err
}
_, err = ec2.NewInstance(ctx, "web", &ec2.InstanceArgs{
Ami: pulumi.String(ubuntu.Id),
InstanceType: pulumi.String("t2.micro"),
Tags: pulumi.StringMap{
"Name": pulumi.String("HelloWorld"),
},
})
if err != nil {
return err
}
return nil
})
}import pulumi
import pulumi_aws as aws
ubuntu = aws.get_ami(filters=[
{
"name": "name",
"values": ["ubuntu/images/hvm-ssd/ubuntu-trusty-14.04-amd64-server-*"],
},
{
"name": "virtualization-type",
"values": ["hvm"],
},
],
most_recent=True,
owners=["099720109477"])
web = aws.ec2.Instance("web",
ami=ubuntu.id,
instance_type="t2.micro",
tags={
"Name": "HelloWorld",
})import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const ubuntu = pulumi.output(aws.getAmi({
filters: [
{
name: "name",
values: ["ubuntu/images/hvm-ssd/ubuntu-trusty-14.04-amd64-server-*"],
},
{
name: "virtualization-type",
values: ["hvm"],
},
],
mostRecent: true,
owners: ["099720109477"], // Canonical
}, { async: true }));
const web = new aws.ec2.Instance("web", {
ami: ubuntu.id,
instanceType: "t2.micro",
tags: {
Name: "HelloWorld",
},
});Create a Instance Resource
new Instance(name: string, args: InstanceArgs, opts?: CustomResourceOptions);def Instance(resource_name, opts=None, ami=None, associate_public_ip_address=None, availability_zone=None, cpu_core_count=None, cpu_threads_per_core=None, credit_specification=None, disable_api_termination=None, ebs_block_devices=None, ebs_optimized=None, ephemeral_block_devices=None, get_password_data=None, hibernation=None, host_id=None, iam_instance_profile=None, instance_initiated_shutdown_behavior=None, instance_type=None, ipv6_address_count=None, ipv6_addresses=None, key_name=None, metadata_options=None, monitoring=None, network_interfaces=None, placement_group=None, private_ip=None, root_block_device=None, security_groups=None, source_dest_check=None, subnet_id=None, tags=None, tenancy=None, user_data=None, user_data_base64=None, volume_tags=None, vpc_security_group_ids=None, __props__=None);func NewInstance(ctx *Context, name string, args InstanceArgs, opts ...ResourceOption) (*Instance, error)public Instance(string name, InstanceArgs args, CustomResourceOptions? opts = null)- name string
- The unique name of the resource.
- args InstanceArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- opts ResourceOptions
- A bag of options that control this resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args InstanceArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args InstanceArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
Instance Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.
Inputs
The Instance resource accepts the following input properties:
- Ami string
The AMI to use for the instance.
- Instance
Type string The type of instance to start. Updates to this field will trigger a stop/start of the EC2 instance.
- Associate
Public boolIp Address Associate a public ip address with an instance in a VPC. Boolean value.
- Availability
Zone string The AZ to start the instance in.
- Cpu
Core intCount Sets the number of CPU cores for an instance. This option is only supported on creation of instance type that support CPU Options CPU Cores and Threads Per CPU Core Per Instance Type - specifying this option for unsupported instance types will return an error from the EC2 API.
- Cpu
Threads intPer Core If set to to 1, hyperthreading is disabled on the launched instance. Defaults to 2 if not set. See Optimizing CPU Options for more information.
- Credit
Specification InstanceCredit Specification Args Customize the credit specification of the instance. See Credit Specification below for more details.
- Disable
Api boolTermination If true, enables EC2 Instance Termination Protection
- Ebs
Block List<InstanceDevices Ebs Block Device Args> 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.
- Ebs
Optimized 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.
- Ephemeral
Block List<InstanceDevices Ephemeral Block Device Args> Customize Ephemeral (also known as “Instance Store”) volumes on the instance. See Block Devices below for details.
- Get
Password boolData 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
password_dataattribute. See GetPasswordData for more information.- Hibernation bool
If true, the launched EC2 instance will support hibernation.
- Host
Id string The 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.
- Iam
Instance stringProfile The 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.- Instance
Initiated stringShutdown Behavior 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.- Ipv6Address
Count int A number of IPv6 addresses to associate with the primary network interface. Amazon EC2 chooses the IPv6 addresses from the range of your subnet.
- Ipv6Addresses List<string>
Specify one or more IPv6 addresses from the range of the subnet to associate with the primary network interface
- Key
Name string The key name of the Key Pair to use for the instance; which can be managed using the
aws.ec2.KeyPairresource.- Metadata
Options InstanceMetadata Options Args Customize the metadata options of the instance. See Metadata Options below for more details.
- Monitoring bool
If true, the launched EC2 instance will have detailed monitoring enabled. (Available since v0.6.0)
- Network
Interfaces List<InstanceNetwork Interface Args> Customize network interfaces to be attached at instance boot time. See Network Interfaces below for more details.
- Placement
Group string The Placement Group to start the instance in.
- Private
Ip string Private IP address to associate with the instance in a VPC.
- Root
Block InstanceDevice Root Block Device Args Customize details about the root block device of the instance. See Block Devices below for details.
- Security
Groups List<string> A list of security group names (EC2-Classic) or IDs (default VPC) to associate with.
- Source
Dest boolCheck Controls if traffic is routed to the instance when the destination address does not match the instance. Used for NAT or VPNs. Defaults true.
- Subnet
Id string The VPC Subnet ID to launch in.
- Dictionary<string, string>
A map of tags to assign to the resource.
- Tenancy string
The tenancy of the instance (if the instance is running in a VPC). An instance with a tenancy of dedicated runs on single-tenant hardware. The host tenancy is not supported for the import-instance command.
- User
Data string The user data to provide when launching the instance. Do not pass gzip-compressed data via this argument; see
user_data_base64instead.- User
Data stringBase64 Can be used instead of
user_datato pass base64-encoded binary data directly. Use this instead ofuser_datawhenever 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.- Dictionary<string, string>
A map of tags to assign to the devices created by the instance at launch time.
- Vpc
Security List<string>Group Ids A list of security group IDs to associate with.
- Ami string
The AMI to use for the instance.
- Instance
Type string The type of instance to start. Updates to this field will trigger a stop/start of the EC2 instance.
- Associate
Public boolIp Address Associate a public ip address with an instance in a VPC. Boolean value.
- Availability
Zone string The AZ to start the instance in.
- Cpu
Core intCount Sets the number of CPU cores for an instance. This option is only supported on creation of instance type that support CPU Options CPU Cores and Threads Per CPU Core Per Instance Type - specifying this option for unsupported instance types will return an error from the EC2 API.
- Cpu
Threads intPer Core If set to to 1, hyperthreading is disabled on the launched instance. Defaults to 2 if not set. See Optimizing CPU Options for more information.
- Credit
Specification InstanceCredit Specification Customize the credit specification of the instance. See Credit Specification below for more details.
- Disable
Api boolTermination If true, enables EC2 Instance Termination Protection
- Ebs
Block []InstanceDevices Ebs Block Device 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.
- Ebs
Optimized 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.
- Ephemeral
Block []InstanceDevices Ephemeral Block Device Customize Ephemeral (also known as “Instance Store”) volumes on the instance. See Block Devices below for details.
- Get
Password boolData 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
password_dataattribute. See GetPasswordData for more information.- Hibernation bool
If true, the launched EC2 instance will support hibernation.
- Host
Id string The 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.
- Iam
Instance interface{}Profile The 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.- Instance
Initiated stringShutdown Behavior 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.- Ipv6Address
Count int A number of IPv6 addresses to associate with the primary network interface. Amazon EC2 chooses the IPv6 addresses from the range of your subnet.
- Ipv6Addresses []string
Specify one or more IPv6 addresses from the range of the subnet to associate with the primary network interface
- Key
Name string The key name of the Key Pair to use for the instance; which can be managed using the
aws.ec2.KeyPairresource.- Metadata
Options InstanceMetadata Options Customize the metadata options of the instance. See Metadata Options below for more details.
- Monitoring bool
If true, the launched EC2 instance will have detailed monitoring enabled. (Available since v0.6.0)
- Network
Interfaces []InstanceNetwork Interface Customize network interfaces to be attached at instance boot time. See Network Interfaces below for more details.
- Placement
Group string The Placement Group to start the instance in.
- Private
Ip string Private IP address to associate with the instance in a VPC.
- Root
Block InstanceDevice Root Block Device Customize details about the root block device of the instance. See Block Devices below for details.
- Security
Groups []string A list of security group names (EC2-Classic) or IDs (default VPC) to associate with.
- Source
Dest boolCheck Controls if traffic is routed to the instance when the destination address does not match the instance. Used for NAT or VPNs. Defaults true.
- Subnet
Id string The VPC Subnet ID to launch in.
- map[string]string
A map of tags to assign to the resource.
- Tenancy string
The tenancy of the instance (if the instance is running in a VPC). An instance with a tenancy of dedicated runs on single-tenant hardware. The host tenancy is not supported for the import-instance command.
- User
Data string The user data to provide when launching the instance. Do not pass gzip-compressed data via this argument; see
user_data_base64instead.- User
Data stringBase64 Can be used instead of
user_datato pass base64-encoded binary data directly. Use this instead ofuser_datawhenever 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.- map[string]string
A map of tags to assign to the devices created by the instance at launch time.
- Vpc
Security []stringGroup Ids A list of security group IDs to associate with.
- ami string
The AMI to use for the instance.
- instance
Type InstanceType The type of instance to start. Updates to this field will trigger a stop/start of the EC2 instance.
- associate
Public booleanIp Address Associate a public ip address with an instance in a VPC. Boolean value.
- availability
Zone string The AZ to start the instance in.
- cpu
Core numberCount Sets the number of CPU cores for an instance. This option is only supported on creation of instance type that support CPU Options CPU Cores and Threads Per CPU Core Per Instance Type - specifying this option for unsupported instance types will return an error from the EC2 API.
- cpu
Threads numberPer Core If set to to 1, hyperthreading is disabled on the launched instance. Defaults to 2 if not set. See Optimizing CPU Options for more information.
- credit
Specification InstanceCredit Specification Customize the credit specification of the instance. See Credit Specification below for more details.
- disable
Api booleanTermination If true, enables EC2 Instance Termination Protection
- ebs
Block InstanceDevices Ebs Block Device[] 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.
- ebs
Optimized boolean 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.
- ephemeral
Block InstanceDevices Ephemeral Block Device[] Customize Ephemeral (also known as “Instance Store”) volumes on the instance. See Block Devices below for details.
- get
Password booleanData 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
password_dataattribute. See GetPasswordData for more information.- hibernation boolean
If true, the launched EC2 instance will support hibernation.
- host
Id string The 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.
- iam
Instance string | InstanceProfile Profile The 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.- instance
Initiated stringShutdown Behavior 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.- ipv6Address
Count number A number of IPv6 addresses to associate with the primary network interface. Amazon EC2 chooses the IPv6 addresses from the range of your subnet.
- ipv6Addresses string[]
Specify one or more IPv6 addresses from the range of the subnet to associate with the primary network interface
- key
Name string The key name of the Key Pair to use for the instance; which can be managed using the
aws.ec2.KeyPairresource.- metadata
Options InstanceMetadata Options Customize the metadata options of the instance. See Metadata Options below for more details.
- monitoring boolean
If true, the launched EC2 instance will have detailed monitoring enabled. (Available since v0.6.0)
- network
Interfaces InstanceNetwork Interface[] Customize network interfaces to be attached at instance boot time. See Network Interfaces below for more details.
- placement
Group string The Placement Group to start the instance in.
- private
Ip string Private IP address to associate with the instance in a VPC.
- root
Block InstanceDevice Root Block Device Customize details about the root block device of the instance. See Block Devices below for details.
- security
Groups string[] A list of security group names (EC2-Classic) or IDs (default VPC) to associate with.
- source
Dest booleanCheck Controls if traffic is routed to the instance when the destination address does not match the instance. Used for NAT or VPNs. Defaults true.
- subnet
Id string The VPC Subnet ID to launch in.
- {[key: string]: string}
A map of tags to assign to the resource.
- tenancy string
The tenancy of the instance (if the instance is running in a VPC). An instance with a tenancy of dedicated runs on single-tenant hardware. The host tenancy is not supported for the import-instance command.
- user
Data string The user data to provide when launching the instance. Do not pass gzip-compressed data via this argument; see
user_data_base64instead.- user
Data stringBase64 Can be used instead of
user_datato pass base64-encoded binary data directly. Use this instead ofuser_datawhenever 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.- {[key: string]: string}
A map of tags to assign to the devices created by the instance at launch time.
- vpc
Security string[]Group Ids A list of security group IDs to associate with.
- ami str
The AMI to use for the instance.
- instance_
type str The type of instance to start. Updates to this field will trigger a stop/start of the EC2 instance.
- associate_
public_ boolip_ address Associate a public ip address with an instance in a VPC. Boolean value.
- availability_
zone str The AZ to start the instance in.
- cpu_
core_ floatcount Sets the number of CPU cores for an instance. This option is only supported on creation of instance type that support CPU Options CPU Cores and Threads Per CPU Core Per Instance Type - specifying this option for unsupported instance types will return an error from the EC2 API.
- cpu_
threads_ floatper_ core If set to to 1, hyperthreading is disabled on the launched instance. Defaults to 2 if not set. See Optimizing CPU Options for more information.
- credit_
specification Dict[InstanceCredit Specification] Customize the credit specification of the instance. See Credit Specification below for more details.
- disable_
api_ booltermination If true, enables EC2 Instance Termination Protection
- ebs_
block_ List[Instancedevices Ebs Block Device] 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.
- ebs_
optimized 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.
- ephemeral_
block_ List[Instancedevices Ephemeral Block Device] Customize Ephemeral (also known as “Instance Store”) volumes on the instance. See Block Devices below for details.
- get_
password_ booldata 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
password_dataattribute. See GetPasswordData for more information.- hibernation bool
If true, the launched EC2 instance will support hibernation.
- host_
id str The 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.
- iam_
instance_ string | strprofile The 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.- instance_
initiated_ strshutdown_ behavior 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.- ipv6_
address_ floatcount A number of IPv6 addresses to associate with the primary network interface. Amazon EC2 chooses the IPv6 addresses from the range of your subnet.
- ipv6_
addresses List[str] Specify one or more IPv6 addresses from the range of the subnet to associate with the primary network interface
- key_
name str The key name of the Key Pair to use for the instance; which can be managed using the
aws.ec2.KeyPairresource.- metadata_
options Dict[InstanceMetadata Options] Customize the metadata options of the instance. See Metadata Options below for more details.
- monitoring bool
If true, the launched EC2 instance will have detailed monitoring enabled. (Available since v0.6.0)
- network_
interfaces List[InstanceNetwork Interface] Customize network interfaces to be attached at instance boot time. See Network Interfaces below for more details.
- placement_
group str The Placement Group to start the instance in.
- private_
ip str Private IP address to associate with the instance in a VPC.
- root_
block_ Dict[Instancedevice Root Block Device] Customize details about the root block device of the instance. See Block Devices below for details.
- security_
groups List[str] A list of security group names (EC2-Classic) or IDs (default VPC) to associate with.
- source_
dest_ boolcheck Controls if traffic is routed to the instance when the destination address does not match the instance. Used for NAT or VPNs. Defaults true.
- subnet_
id str The VPC Subnet ID to launch in.
- Dict[str, str]
A map of tags to assign to the resource.
- tenancy str
The tenancy of the instance (if the instance is running in a VPC). An instance with a tenancy of dedicated runs on single-tenant hardware. The host tenancy is not supported for the import-instance command.
- user_
data str The user data to provide when launching the instance. Do not pass gzip-compressed data via this argument; see
user_data_base64instead.- user_
data_ strbase64 Can be used instead of
user_datato pass base64-encoded binary data directly. Use this instead ofuser_datawhenever 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.- Dict[str, str]
A map of tags to assign to the devices created by the instance at launch time.
- vpc_
security_ List[str]group_ ids A list of security group IDs to associate with.
Outputs
All input properties are implicitly available as output properties. Additionally, the Instance resource produces the following output properties:
- Arn string
The ARN of the instance.
- Id string
- The provider-assigned unique ID for this managed resource.
- Outpost
Arn string The ARN of the Outpost the instance is assigned to.
- Password
Data 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
get_password_datais true. Note that this encrypted value will be stored in the state file, as with all exported attributes. See GetPasswordData for more information.- Primary
Network stringInterface Id The ID of the instance’s primary network interface.
- Private
Dns string The 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
- Public
Dns string The public DNS name assigned to the instance. For EC2-VPC, this is only available if you’ve enabled DNS hostnames for your VPC
- Public
Ip string The 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 usepublic_ip, as this field will change after the EIP is attached.- State string
The state of the instance. One of:
pending,running,shutting-down,terminated,stopping,stopped. See Instance Lifecycle for more information.
- Arn string
The ARN of the instance.
- Id string
- The provider-assigned unique ID for this managed resource.
- Instance
State string The state of the instance. One of:
pending,running,shutting-down,terminated,stopping,stopped. See Instance Lifecycle for more information.- Outpost
Arn string The ARN of the Outpost the instance is assigned to.
- Password
Data 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
get_password_datais true. Note that this encrypted value will be stored in the state file, as with all exported attributes. See GetPasswordData for more information.- Primary
Network stringInterface Id The ID of the instance’s primary network interface.
- Private
Dns string The 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
- Public
Dns string The public DNS name assigned to the instance. For EC2-VPC, this is only available if you’ve enabled DNS hostnames for your VPC
- Public
Ip string The 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 usepublic_ip, as this field will change after the EIP is attached.
- arn string
The ARN of the instance.
- id string
- The provider-assigned unique ID for this managed resource.
- instance
State string The state of the instance. One of:
pending,running,shutting-down,terminated,stopping,stopped. See Instance Lifecycle for more information.- outpost
Arn string The ARN of the Outpost the instance is assigned to.
- password
Data 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
get_password_datais true. Note that this encrypted value will be stored in the state file, as with all exported attributes. See GetPasswordData for more information.- primary
Network stringInterface Id The ID of the instance’s primary network interface.
- private
Dns string The 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
- public
Dns string The public DNS name assigned to the instance. For EC2-VPC, this is only available if you’ve enabled DNS hostnames for your VPC
- public
Ip string The 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 usepublic_ip, as this field will change after the EIP is attached.
- arn str
The ARN of the instance.
- id str
- The provider-assigned unique ID for this managed resource.
- instance_
state str The state of the instance. One of:
pending,running,shutting-down,terminated,stopping,stopped. See Instance Lifecycle for more information.- outpost_
arn str The ARN of the Outpost the instance is assigned to.
- password_
data str 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
get_password_datais true. Note that this encrypted value will be stored in the state file, as with all exported attributes. See GetPasswordData for more information.- primary_
network_ strinterface_ id The ID of the instance’s primary network interface.
- private_
dns str The 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
- public_
dns str The public DNS name assigned to the instance. For EC2-VPC, this is only available if you’ve enabled DNS hostnames for your VPC
- public_
ip str The 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 usepublic_ip, as this field will change after the EIP is attached.
Look up an Existing Instance Resource
Get an existing Instance resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: InstanceState, opts?: CustomResourceOptions): Instancestatic get(resource_name, id, opts=None, ami=None, arn=None, associate_public_ip_address=None, availability_zone=None, cpu_core_count=None, cpu_threads_per_core=None, credit_specification=None, disable_api_termination=None, ebs_block_devices=None, ebs_optimized=None, ephemeral_block_devices=None, get_password_data=None, hibernation=None, host_id=None, iam_instance_profile=None, instance_initiated_shutdown_behavior=None, instance_state=None, instance_type=None, ipv6_address_count=None, ipv6_addresses=None, key_name=None, metadata_options=None, monitoring=None, network_interfaces=None, outpost_arn=None, password_data=None, placement_group=None, primary_network_interface_id=None, private_dns=None, private_ip=None, public_dns=None, public_ip=None, root_block_device=None, security_groups=None, source_dest_check=None, subnet_id=None, tags=None, tenancy=None, user_data=None, user_data_base64=None, volume_tags=None, vpc_security_group_ids=None, __props__=None);func GetInstance(ctx *Context, name string, id IDInput, state *InstanceState, opts ...ResourceOption) (*Instance, error)public static Instance Get(string name, Input<string> id, InstanceState? state, CustomResourceOptions? opts = null)- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
The following state arguments are supported:
- Ami string
The AMI to use for the instance.
- Arn string
The ARN of the instance.
- Associate
Public boolIp Address Associate a public ip address with an instance in a VPC. Boolean value.
- Availability
Zone string The AZ to start the instance in.
- Cpu
Core intCount Sets the number of CPU cores for an instance. This option is only supported on creation of instance type that support CPU Options CPU Cores and Threads Per CPU Core Per Instance Type - specifying this option for unsupported instance types will return an error from the EC2 API.
- Cpu
Threads intPer Core If set to to 1, hyperthreading is disabled on the launched instance. Defaults to 2 if not set. See Optimizing CPU Options for more information.
- Credit
Specification InstanceCredit Specification Args Customize the credit specification of the instance. See Credit Specification below for more details.
- Disable
Api boolTermination If true, enables EC2 Instance Termination Protection
- Ebs
Block List<InstanceDevices Ebs Block Device Args> 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.
- Ebs
Optimized 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.
- Ephemeral
Block List<InstanceDevices Ephemeral Block Device Args> Customize Ephemeral (also known as “Instance Store”) volumes on the instance. See Block Devices below for details.
- Get
Password boolData 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
password_dataattribute. See GetPasswordData for more information.- Hibernation bool
If true, the launched EC2 instance will support hibernation.
- Host
Id string The 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.
- Iam
Instance stringProfile The 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.- Instance
Initiated stringShutdown Behavior 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.- Instance
Type string The type of instance to start. Updates to this field will trigger a stop/start of the EC2 instance.
- Ipv6Address
Count int A number of IPv6 addresses to associate with the primary network interface. Amazon EC2 chooses the IPv6 addresses from the range of your subnet.
- Ipv6Addresses List<string>
Specify one or more IPv6 addresses from the range of the subnet to associate with the primary network interface
- Key
Name string The key name of the Key Pair to use for the instance; which can be managed using the
aws.ec2.KeyPairresource.- Metadata
Options InstanceMetadata Options Args Customize the metadata options of the instance. See Metadata Options below for more details.
- Monitoring bool
If true, the launched EC2 instance will have detailed monitoring enabled. (Available since v0.6.0)
- Network
Interfaces List<InstanceNetwork Interface Args> Customize network interfaces to be attached at instance boot time. See Network Interfaces below for more details.
- Outpost
Arn string The ARN of the Outpost the instance is assigned to.
- Password
Data 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
get_password_datais true. Note that this encrypted value will be stored in the state file, as with all exported attributes. See GetPasswordData for more information.- Placement
Group string The Placement Group to start the instance in.
- Primary
Network stringInterface Id The ID of the instance’s primary network interface.
- Private
Dns string The 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
- Private
Ip string Private IP address to associate with the instance in a VPC.
- Public
Dns string The public DNS name assigned to the instance. For EC2-VPC, this is only available if you’ve enabled DNS hostnames for your VPC
- Public
Ip string The 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 usepublic_ip, as this field will change after the EIP is attached.- Root
Block InstanceDevice Root Block Device Args Customize details about the root block device of the instance. See Block Devices below for details.
- Security
Groups List<string> A list of security group names (EC2-Classic) or IDs (default VPC) to associate with.
- Source
Dest boolCheck Controls if traffic is routed to the instance when the destination address does not match the instance. Used for NAT or VPNs. Defaults true.
- State string
The state of the instance. One of:
pending,running,shutting-down,terminated,stopping,stopped. See Instance Lifecycle for more information.- Subnet
Id string The VPC Subnet ID to launch in.
- Dictionary<string, string>
A map of tags to assign to the resource.
- Tenancy string
The tenancy of the instance (if the instance is running in a VPC). An instance with a tenancy of dedicated runs on single-tenant hardware. The host tenancy is not supported for the import-instance command.
- User
Data string The user data to provide when launching the instance. Do not pass gzip-compressed data via this argument; see
user_data_base64instead.- User
Data stringBase64 Can be used instead of
user_datato pass base64-encoded binary data directly. Use this instead ofuser_datawhenever 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.- Dictionary<string, string>
A map of tags to assign to the devices created by the instance at launch time.
- Vpc
Security List<string>Group Ids A list of security group IDs to associate with.
- Ami string
The AMI to use for the instance.
- Arn string
The ARN of the instance.
- Associate
Public boolIp Address Associate a public ip address with an instance in a VPC. Boolean value.
- Availability
Zone string The AZ to start the instance in.
- Cpu
Core intCount Sets the number of CPU cores for an instance. This option is only supported on creation of instance type that support CPU Options CPU Cores and Threads Per CPU Core Per Instance Type - specifying this option for unsupported instance types will return an error from the EC2 API.
- Cpu
Threads intPer Core If set to to 1, hyperthreading is disabled on the launched instance. Defaults to 2 if not set. See Optimizing CPU Options for more information.
- Credit
Specification InstanceCredit Specification Customize the credit specification of the instance. See Credit Specification below for more details.
- Disable
Api boolTermination If true, enables EC2 Instance Termination Protection
- Ebs
Block []InstanceDevices Ebs Block Device 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.
- Ebs
Optimized 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.
- Ephemeral
Block []InstanceDevices Ephemeral Block Device Customize Ephemeral (also known as “Instance Store”) volumes on the instance. See Block Devices below for details.
- Get
Password boolData 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
password_dataattribute. See GetPasswordData for more information.- Hibernation bool
If true, the launched EC2 instance will support hibernation.
- Host
Id string The 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.
- Iam
Instance interface{}Profile The 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.- Instance
Initiated stringShutdown Behavior 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.- Instance
State string The state of the instance. One of:
pending,running,shutting-down,terminated,stopping,stopped. See Instance Lifecycle for more information.- Instance
Type string The type of instance to start. Updates to this field will trigger a stop/start of the EC2 instance.
- Ipv6Address
Count int A number of IPv6 addresses to associate with the primary network interface. Amazon EC2 chooses the IPv6 addresses from the range of your subnet.
- Ipv6Addresses []string
Specify one or more IPv6 addresses from the range of the subnet to associate with the primary network interface
- Key
Name string The key name of the Key Pair to use for the instance; which can be managed using the
aws.ec2.KeyPairresource.- Metadata
Options InstanceMetadata Options Customize the metadata options of the instance. See Metadata Options below for more details.
- Monitoring bool
If true, the launched EC2 instance will have detailed monitoring enabled. (Available since v0.6.0)
- Network
Interfaces []InstanceNetwork Interface Customize network interfaces to be attached at instance boot time. See Network Interfaces below for more details.
- Outpost
Arn string The ARN of the Outpost the instance is assigned to.
- Password
Data 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
get_password_datais true. Note that this encrypted value will be stored in the state file, as with all exported attributes. See GetPasswordData for more information.- Placement
Group string The Placement Group to start the instance in.
- Primary
Network stringInterface Id The ID of the instance’s primary network interface.
- Private
Dns string The 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
- Private
Ip string Private IP address to associate with the instance in a VPC.
- Public
Dns string The public DNS name assigned to the instance. For EC2-VPC, this is only available if you’ve enabled DNS hostnames for your VPC
- Public
Ip string The 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 usepublic_ip, as this field will change after the EIP is attached.- Root
Block InstanceDevice Root Block Device Customize details about the root block device of the instance. See Block Devices below for details.
- Security
Groups []string A list of security group names (EC2-Classic) or IDs (default VPC) to associate with.
- Source
Dest boolCheck Controls if traffic is routed to the instance when the destination address does not match the instance. Used for NAT or VPNs. Defaults true.
- Subnet
Id string The VPC Subnet ID to launch in.
- map[string]string
A map of tags to assign to the resource.
- Tenancy string
The tenancy of the instance (if the instance is running in a VPC). An instance with a tenancy of dedicated runs on single-tenant hardware. The host tenancy is not supported for the import-instance command.
- User
Data string The user data to provide when launching the instance. Do not pass gzip-compressed data via this argument; see
user_data_base64instead.- User
Data stringBase64 Can be used instead of
user_datato pass base64-encoded binary data directly. Use this instead ofuser_datawhenever 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.- map[string]string
A map of tags to assign to the devices created by the instance at launch time.
- Vpc
Security []stringGroup Ids A list of security group IDs to associate with.
- ami string
The AMI to use for the instance.
- arn string
The ARN of the instance.
- associate
Public booleanIp Address Associate a public ip address with an instance in a VPC. Boolean value.
- availability
Zone string The AZ to start the instance in.
- cpu
Core numberCount Sets the number of CPU cores for an instance. This option is only supported on creation of instance type that support CPU Options CPU Cores and Threads Per CPU Core Per Instance Type - specifying this option for unsupported instance types will return an error from the EC2 API.
- cpu
Threads numberPer Core If set to to 1, hyperthreading is disabled on the launched instance. Defaults to 2 if not set. See Optimizing CPU Options for more information.
- credit
Specification InstanceCredit Specification Customize the credit specification of the instance. See Credit Specification below for more details.
- disable
Api booleanTermination If true, enables EC2 Instance Termination Protection
- ebs
Block InstanceDevices Ebs Block Device[] 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.
- ebs
Optimized boolean 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.
- ephemeral
Block InstanceDevices Ephemeral Block Device[] Customize Ephemeral (also known as “Instance Store”) volumes on the instance. See Block Devices below for details.
- get
Password booleanData 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
password_dataattribute. See GetPasswordData for more information.- hibernation boolean
If true, the launched EC2 instance will support hibernation.
- host
Id string The 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.
- iam
Instance string | InstanceProfile Profile The 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.- instance
Initiated stringShutdown Behavior 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.- instance
State string The state of the instance. One of:
pending,running,shutting-down,terminated,stopping,stopped. See Instance Lifecycle for more information.- instance
Type InstanceType The type of instance to start. Updates to this field will trigger a stop/start of the EC2 instance.
- ipv6Address
Count number A number of IPv6 addresses to associate with the primary network interface. Amazon EC2 chooses the IPv6 addresses from the range of your subnet.
- ipv6Addresses string[]
Specify one or more IPv6 addresses from the range of the subnet to associate with the primary network interface
- key
Name string The key name of the Key Pair to use for the instance; which can be managed using the
aws.ec2.KeyPairresource.- metadata
Options InstanceMetadata Options Customize the metadata options of the instance. See Metadata Options below for more details.
- monitoring boolean
If true, the launched EC2 instance will have detailed monitoring enabled. (Available since v0.6.0)
- network
Interfaces InstanceNetwork Interface[] Customize network interfaces to be attached at instance boot time. See Network Interfaces below for more details.
- outpost
Arn string The ARN of the Outpost the instance is assigned to.
- password
Data 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
get_password_datais true. Note that this encrypted value will be stored in the state file, as with all exported attributes. See GetPasswordData for more information.- placement
Group string The Placement Group to start the instance in.
- primary
Network stringInterface Id The ID of the instance’s primary network interface.
- private
Dns string The 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
- private
Ip string Private IP address to associate with the instance in a VPC.
- public
Dns string The public DNS name assigned to the instance. For EC2-VPC, this is only available if you’ve enabled DNS hostnames for your VPC
- public
Ip string The 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 usepublic_ip, as this field will change after the EIP is attached.- root
Block InstanceDevice Root Block Device Customize details about the root block device of the instance. See Block Devices below for details.
- security
Groups string[] A list of security group names (EC2-Classic) or IDs (default VPC) to associate with.
- source
Dest booleanCheck Controls if traffic is routed to the instance when the destination address does not match the instance. Used for NAT or VPNs. Defaults true.
- subnet
Id string The VPC Subnet ID to launch in.
- {[key: string]: string}
A map of tags to assign to the resource.
- tenancy string
The tenancy of the instance (if the instance is running in a VPC). An instance with a tenancy of dedicated runs on single-tenant hardware. The host tenancy is not supported for the import-instance command.
- user
Data string The user data to provide when launching the instance. Do not pass gzip-compressed data via this argument; see
user_data_base64instead.- user
Data stringBase64 Can be used instead of
user_datato pass base64-encoded binary data directly. Use this instead ofuser_datawhenever 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.- {[key: string]: string}
A map of tags to assign to the devices created by the instance at launch time.
- vpc
Security string[]Group Ids A list of security group IDs to associate with.
- ami str
The AMI to use for the instance.
- arn str
The ARN of the instance.
- associate_
public_ boolip_ address Associate a public ip address with an instance in a VPC. Boolean value.
- availability_
zone str The AZ to start the instance in.
- cpu_
core_ floatcount Sets the number of CPU cores for an instance. This option is only supported on creation of instance type that support CPU Options CPU Cores and Threads Per CPU Core Per Instance Type - specifying this option for unsupported instance types will return an error from the EC2 API.
- cpu_
threads_ floatper_ core If set to to 1, hyperthreading is disabled on the launched instance. Defaults to 2 if not set. See Optimizing CPU Options for more information.
- credit_
specification Dict[InstanceCredit Specification] Customize the credit specification of the instance. See Credit Specification below for more details.
- disable_
api_ booltermination If true, enables EC2 Instance Termination Protection
- ebs_
block_ List[Instancedevices Ebs Block Device] 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.
- ebs_
optimized 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.
- ephemeral_
block_ List[Instancedevices Ephemeral Block Device] Customize Ephemeral (also known as “Instance Store”) volumes on the instance. See Block Devices below for details.
- get_
password_ booldata 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
password_dataattribute. See GetPasswordData for more information.- hibernation bool
If true, the launched EC2 instance will support hibernation.
- host_
id str The 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.
- iam_
instance_ string | strprofile The 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.- instance_
initiated_ strshutdown_ behavior 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.- instance_
state str The state of the instance. One of:
pending,running,shutting-down,terminated,stopping,stopped. See Instance Lifecycle for more information.- instance_
type str The type of instance to start. Updates to this field will trigger a stop/start of the EC2 instance.
- ipv6_
address_ floatcount A number of IPv6 addresses to associate with the primary network interface. Amazon EC2 chooses the IPv6 addresses from the range of your subnet.
- ipv6_
addresses List[str] Specify one or more IPv6 addresses from the range of the subnet to associate with the primary network interface
- key_
name str The key name of the Key Pair to use for the instance; which can be managed using the
aws.ec2.KeyPairresource.- metadata_
options Dict[InstanceMetadata Options] Customize the metadata options of the instance. See Metadata Options below for more details.
- monitoring bool
If true, the launched EC2 instance will have detailed monitoring enabled. (Available since v0.6.0)
- network_
interfaces List[InstanceNetwork Interface] Customize network interfaces to be attached at instance boot time. See Network Interfaces below for more details.
- outpost_
arn str The ARN of the Outpost the instance is assigned to.
- password_
data str 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
get_password_datais true. Note that this encrypted value will be stored in the state file, as with all exported attributes. See GetPasswordData for more information.- placement_
group str The Placement Group to start the instance in.
- primary_
network_ strinterface_ id The ID of the instance’s primary network interface.
- private_
dns str The 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
- private_
ip str Private IP address to associate with the instance in a VPC.
- public_
dns str The public DNS name assigned to the instance. For EC2-VPC, this is only available if you’ve enabled DNS hostnames for your VPC
- public_
ip str The 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 usepublic_ip, as this field will change after the EIP is attached.- root_
block_ Dict[Instancedevice Root Block Device] Customize details about the root block device of the instance. See Block Devices below for details.
- security_
groups List[str] A list of security group names (EC2-Classic) or IDs (default VPC) to associate with.
- source_
dest_ boolcheck Controls if traffic is routed to the instance when the destination address does not match the instance. Used for NAT or VPNs. Defaults true.
- subnet_
id str The VPC Subnet ID to launch in.
- Dict[str, str]
A map of tags to assign to the resource.
- tenancy str
The tenancy of the instance (if the instance is running in a VPC). An instance with a tenancy of dedicated runs on single-tenant hardware. The host tenancy is not supported for the import-instance command.
- user_
data str The user data to provide when launching the instance. Do not pass gzip-compressed data via this argument; see
user_data_base64instead.- user_
data_ strbase64 Can be used instead of
user_datato pass base64-encoded binary data directly. Use this instead ofuser_datawhenever 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.- Dict[str, str]
A map of tags to assign to the devices created by the instance at launch time.
- vpc_
security_ List[str]group_ ids A list of security group IDs to associate with.
Supporting Types
InstanceCreditSpecification
- Cpu
Credits string The credit option for CPU usage. Can be
"standard"or"unlimited". T3 instances are launched as unlimited by default. T2 instances are launched as standard by default.
- Cpu
Credits string The credit option for CPU usage. Can be
"standard"or"unlimited". T3 instances are launched as unlimited by default. T2 instances are launched as standard by default.
- cpu
Credits string The credit option for CPU usage. Can be
"standard"or"unlimited". T3 instances are launched as unlimited by default. T2 instances are launched as standard by default.
- cpu
Credits str The credit option for CPU usage. Can be
"standard"or"unlimited". T3 instances are launched as unlimited by default. T2 instances are launched as standard by default.
InstanceEbsBlockDevice
- Device
Name string The name of the device to mount.
- Delete
On boolTermination Whether the volume should be destroyed on instance termination (Default:
true).- Encrypted bool
Enables EBS encryption on the volume (Default:
false). Cannot be used withsnapshot_id. Must be configured to perform drift detection.- Iops int
The amount of provisioned IOPS. This must be set with a
volume_typeof"io1".- Kms
Key stringId Amazon Resource Name (ARN) of the KMS Key to use when encrypting the volume. Must be configured to perform drift detection.
- Snapshot
Id string The Snapshot ID to mount.
- Volume
Id string - Volume
Size int The size of the volume in gibibytes (GiB).
- Volume
Type string The type of volume. Can be
"standard","gp2", or"io1". (Default:"gp2").
- Device
Name string The name of the device to mount.
- Delete
On boolTermination Whether the volume should be destroyed on instance termination (Default:
true).- Encrypted bool
Enables EBS encryption on the volume (Default:
false). Cannot be used withsnapshot_id. Must be configured to perform drift detection.- Iops int
The amount of provisioned IOPS. This must be set with a
volume_typeof"io1".- Kms
Key stringId Amazon Resource Name (ARN) of the KMS Key to use when encrypting the volume. Must be configured to perform drift detection.
- Snapshot
Id string The Snapshot ID to mount.
- Volume
Id string - Volume
Size int The size of the volume in gibibytes (GiB).
- Volume
Type string The type of volume. Can be
"standard","gp2", or"io1". (Default:"gp2").
- device
Name string The name of the device to mount.
- delete
On booleanTermination Whether the volume should be destroyed on instance termination (Default:
true).- encrypted boolean
Enables EBS encryption on the volume (Default:
false). Cannot be used withsnapshot_id. Must be configured to perform drift detection.- iops number
The amount of provisioned IOPS. This must be set with a
volume_typeof"io1".- kms
Key stringId Amazon Resource Name (ARN) of the KMS Key to use when encrypting the volume. Must be configured to perform drift detection.
- snapshot
Id string The Snapshot ID to mount.
- volume
Id string - volume
Size number The size of the volume in gibibytes (GiB).
- volume
Type string The type of volume. Can be
"standard","gp2", or"io1". (Default:"gp2").
- device_
name str The name of the device to mount.
- delete
On boolTermination Whether the volume should be destroyed on instance termination (Default:
true).- encrypted bool
Enables EBS encryption on the volume (Default:
false). Cannot be used withsnapshot_id. Must be configured to perform drift detection.- iops float
The amount of provisioned IOPS. This must be set with a
volume_typeof"io1".- kms_
key_ strid Amazon Resource Name (ARN) of the KMS Key to use when encrypting the volume. Must be configured to perform drift detection.
- snapshot_
id str The Snapshot ID to mount.
- volume
Type str The type of volume. Can be
"standard","gp2", or"io1". (Default:"gp2").- volume_
id str - volume_
size float The size of the volume in gibibytes (GiB).
InstanceEphemeralBlockDevice
- Device
Name string The name of the block device to mount on the instance.
- No
Device bool Suppresses the specified device included in the AMI’s block device mapping.
- Virtual
Name string The Instance Store Device Name (e.g.
"ephemeral0").
- Device
Name string The name of the block device to mount on the instance.
- No
Device bool Suppresses the specified device included in the AMI’s block device mapping.
- Virtual
Name string The Instance Store Device Name (e.g.
"ephemeral0").
- device
Name string The name of the block device to mount on the instance.
- no
Device boolean Suppresses the specified device included in the AMI’s block device mapping.
- virtual
Name string The Instance Store Device Name (e.g.
"ephemeral0").
- device_
name str The name of the block device to mount on the instance.
- no
Device bool Suppresses the specified device included in the AMI’s block device mapping.
- virtual
Name str The Instance Store Device Name (e.g.
"ephemeral0").
InstanceMetadataOptions
- Http
Endpoint string Whether the metadata service is available. Can be
"enabled"or"disabled". (Default:"enabled").- Http
Put intResponse Hop Limit The desired HTTP PUT response hop limit for instance metadata requests. The larger the number, the further instance metadata requests can travel. Can be an integer from
1to64. (Default:1).- Http
Tokens string Whether or not the metadata service requires session tokens, also referred to as Instance Metadata Service Version 2. Can be
"optional"or"required". (Default:"optional").
- Http
Endpoint string Whether the metadata service is available. Can be
"enabled"or"disabled". (Default:"enabled").- Http
Put intResponse Hop Limit The desired HTTP PUT response hop limit for instance metadata requests. The larger the number, the further instance metadata requests can travel. Can be an integer from
1to64. (Default:1).- Http
Tokens string Whether or not the metadata service requires session tokens, also referred to as Instance Metadata Service Version 2. Can be
"optional"or"required". (Default:"optional").
- http
Endpoint string Whether the metadata service is available. Can be
"enabled"or"disabled". (Default:"enabled").- http
Put numberResponse Hop Limit The desired HTTP PUT response hop limit for instance metadata requests. The larger the number, the further instance metadata requests can travel. Can be an integer from
1to64. (Default:1).- http
Tokens string Whether or not the metadata service requires session tokens, also referred to as Instance Metadata Service Version 2. Can be
"optional"or"required". (Default:"optional").
- http
Endpoint str Whether the metadata service is available. Can be
"enabled"or"disabled". (Default:"enabled").- http
Put floatResponse Hop Limit The desired HTTP PUT response hop limit for instance metadata requests. The larger the number, the further instance metadata requests can travel. Can be an integer from
1to64. (Default:1).- http
Tokens str Whether or not the metadata service requires session tokens, also referred to as Instance Metadata Service Version 2. Can be
"optional"or"required". (Default:"optional").
InstanceNetworkInterface
- Device
Index int The integer index of the network interface attachment. Limited by instance type.
- Network
Interface stringId The ID of the network interface to attach.
- Delete
On boolTermination Whether or not to delete the network interface on instance termination. Defaults to
false. Currently, the only valid value isfalse, as this is only supported when creating new network interfaces when launching an instance.
- Device
Index int The integer index of the network interface attachment. Limited by instance type.
- Network
Interface stringId The ID of the network interface to attach.
- Delete
On boolTermination Whether or not to delete the network interface on instance termination. Defaults to
false. Currently, the only valid value isfalse, as this is only supported when creating new network interfaces when launching an instance.
- device
Index number The integer index of the network interface attachment. Limited by instance type.
- network
Interface stringId The ID of the network interface to attach.
- delete
On booleanTermination Whether or not to delete the network interface on instance termination. Defaults to
false. Currently, the only valid value isfalse, as this is only supported when creating new network interfaces when launching an instance.
- device_
index float The integer index of the network interface attachment. Limited by instance type.
- network_
interface_ strid The ID of the network interface to attach.
- delete
On boolTermination Whether or not to delete the network interface on instance termination. Defaults to
false. Currently, the only valid value isfalse, as this is only supported when creating new network interfaces when launching an instance.
InstanceRootBlockDevice
- Delete
On boolTermination Whether the volume should be destroyed on instance termination (Default:
true).- Device
Name string The name of the device to mount.
- Encrypted bool
Enable volume encryption. (Default:
false). Must be configured to perform drift detection.- Iops int
The amount of provisioned IOPS. This is only valid for
volume_typeof"io1", and must be specified if using that type- Kms
Key stringId Amazon Resource Name (ARN) of the KMS Key to use when encrypting the volume. Must be configured to perform drift detection.
- Volume
Id string - Volume
Size int The size of the volume in gibibytes (GiB).
- Volume
Type string The type of volume. Can be
"standard","gp2","io1","sc1", or"st1". (Default:"standard").
- Delete
On boolTermination Whether the volume should be destroyed on instance termination (Default:
true).- Device
Name string The name of the device to mount.
- Encrypted bool
Enable volume encryption. (Default:
false). Must be configured to perform drift detection.- Iops int
The amount of provisioned IOPS. This is only valid for
volume_typeof"io1", and must be specified if using that type- Kms
Key stringId Amazon Resource Name (ARN) of the KMS Key to use when encrypting the volume. Must be configured to perform drift detection.
- Volume
Id string - Volume
Size int The size of the volume in gibibytes (GiB).
- Volume
Type string The type of volume. Can be
"standard","gp2","io1","sc1", or"st1". (Default:"standard").
- delete
On booleanTermination Whether the volume should be destroyed on instance termination (Default:
true).- device
Name string The name of the device to mount.
- encrypted boolean
Enable volume encryption. (Default:
false). Must be configured to perform drift detection.- iops number
The amount of provisioned IOPS. This is only valid for
volume_typeof"io1", and must be specified if using that type- kms
Key stringId Amazon Resource Name (ARN) of the KMS Key to use when encrypting the volume. Must be configured to perform drift detection.
- volume
Id string - volume
Size number The size of the volume in gibibytes (GiB).
- volume
Type string The type of volume. Can be
"standard","gp2","io1","sc1", or"st1". (Default:"standard").
- delete
On boolTermination Whether the volume should be destroyed on instance termination (Default:
true).- device_
name str The name of the device to mount.
- encrypted bool
Enable volume encryption. (Default:
false). Must be configured to perform drift detection.- iops float
The amount of provisioned IOPS. This is only valid for
volume_typeof"io1", and must be specified if using that type- kms_
key_ strid Amazon Resource Name (ARN) of the KMS Key to use when encrypting the volume. Must be configured to perform drift detection.
- volume
Type str The type of volume. Can be
"standard","gp2","io1","sc1", or"st1". (Default:"standard").- volume_
id str - volume_
size float The size of the volume in gibibytes (GiB).
Package Details
- Repository
- https://github.com/pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
awsTerraform Provider.