-
Notifications
You must be signed in to change notification settings - Fork 156
/
instance.ts
797 lines (788 loc) · 47.4 KB
/
instance.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
import * as pulumi from "@pulumi/pulumi";
import { input as inputs, output as outputs, enums } from "../types";
import * as utilities from "../utilities";
import {InstanceProfile} from "../iam";
/**
* Provides an EC2 instance resource. This allows instances to be created, updated, and deleted.
*
* ## Example Usage
* ### Basic Example Using AMI Lookup
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const ubuntu = aws.ec2.getAmi({
* mostRecent: true,
* filters: [
* {
* name: "name",
* values: ["ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-*"],
* },
* {
* name: "virtualization-type",
* values: ["hvm"],
* },
* ],
* owners: ["099720109477"],
* });
* const web = new aws.ec2.Instance("web", {
* ami: ubuntu.then(ubuntu => ubuntu.id),
* instanceType: "t3.micro",
* tags: {
* Name: "HelloWorld",
* },
* });
* ```
* ### Network and Credit Specification Example
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const myVpc = new aws.ec2.Vpc("myVpc", {
* cidrBlock: "172.16.0.0/16",
* tags: {
* Name: "tf-example",
* },
* });
* const mySubnet = new aws.ec2.Subnet("mySubnet", {
* vpcId: myVpc.id,
* cidrBlock: "172.16.10.0/24",
* availabilityZone: "us-west-2a",
* tags: {
* Name: "tf-example",
* },
* });
* const fooNetworkInterface = new aws.ec2.NetworkInterface("fooNetworkInterface", {
* subnetId: mySubnet.id,
* privateIps: ["172.16.10.100"],
* tags: {
* Name: "primary_network_interface",
* },
* });
* const fooInstance = new aws.ec2.Instance("fooInstance", {
* ami: "ami-005e54dee72cc1d00",
* instanceType: "t2.micro",
* networkInterfaces: [{
* networkInterfaceId: fooNetworkInterface.id,
* deviceIndex: 0,
* }],
* creditSpecification: {
* cpuCredits: "unlimited",
* },
* });
* ```
*
* ## Import
*
* Instances can be imported using the `id`, e.g.,
*
* ```sh
* $ pulumi import aws:ec2/instance:Instance web i-12345678
* ```
*/
export class Instance extends pulumi.CustomResource {
/**
* Get an existing Instance resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state Any extra arguments used during the lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
public static get(name: string, id: pulumi.Input<pulumi.ID>, state?: InstanceState, opts?: pulumi.CustomResourceOptions): Instance {
return new Instance(name, <any>state, { ...opts, id: id });
}
/** @internal */
public static readonly __pulumiType = 'aws:ec2/instance:Instance';
/**
* Returns true if the given object is an instance of Instance. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
public static isInstance(obj: any): obj is Instance {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === Instance.__pulumiType;
}
/**
* AMI to use for the instance. Required unless `launchTemplate` is specified and the Launch Template specifes an AMI. If an AMI is specified in the Launch Template, setting `ami` will override the AMI specified in the Launch Template.
*/
public readonly ami!: pulumi.Output<string>;
/**
* The ARN of the instance.
*/
public /*out*/ readonly arn!: pulumi.Output<string>;
/**
* Whether to associate a public IP address with an instance in a VPC.
*/
public readonly associatePublicIpAddress!: pulumi.Output<boolean>;
/**
* AZ to start the instance in.
*/
public readonly availabilityZone!: pulumi.Output<string>;
/**
* Describes an instance's Capacity Reservation targeting option. See Capacity Reservation Specification below for more details.
*/
public readonly capacityReservationSpecification!: pulumi.Output<outputs.ec2.InstanceCapacityReservationSpecification>;
/**
* 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](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-optimize-cpu.html#cpu-options-supported-instances-values) - specifying this option for unsupported instance types will return an error from the EC2 API.
*/
public readonly cpuCoreCount!: pulumi.Output<number>;
/**
* If set to to 1, hyperthreading is disabled on the launched instance. Defaults to 2 if not set. See [Optimizing CPU Options](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-optimize-cpu.html) for more information.
*/
public readonly cpuThreadsPerCore!: pulumi.Output<number>;
/**
* Configuration block for customizing the credit specification of the instance. See Credit Specification below for more details. the 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.
*/
public readonly creditSpecification!: pulumi.Output<outputs.ec2.InstanceCreditSpecification | undefined>;
/**
* If true, enables [EC2 Instance Termination Protection](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/terminating-instances.html#Using_ChangingDisableAPITermination).
*/
public readonly disableApiTermination!: pulumi.Output<boolean>;
/**
* 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.
*/
public readonly ebsBlockDevices!: pulumi.Output<outputs.ec2.InstanceEbsBlockDevice[]>;
/**
* 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](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSOptimized.html) of the AWS User Guide for more information.
*/
public readonly ebsOptimized!: pulumi.Output<boolean>;
/**
* Enable Nitro Enclaves on launched instances. See Enclave Options below for more details.
*/
public readonly enclaveOptions!: pulumi.Output<outputs.ec2.InstanceEnclaveOptions>;
/**
* 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.
*/
public readonly ephemeralBlockDevices!: pulumi.Output<outputs.ec2.InstanceEphemeralBlockDevice[]>;
/**
* 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 `passwordData` attribute. See [GetPasswordData](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_GetPasswordData.html) for more information.
*/
public readonly getPasswordData!: pulumi.Output<boolean | undefined>;
/**
* If true, the launched EC2 instance will support hibernation.
*/
public readonly hibernation!: pulumi.Output<boolean | undefined>;
/**
* 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.
*/
public readonly hostId!: pulumi.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](http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use_switch-role-ec2.html#roles-usingrole-ec2instance-permissions), notably `iam:PassRole`.
*/
public readonly iamInstanceProfile!: pulumi.Output<string | undefined>;
/**
* Shutdown behavior for the instance. Amazon defaults this to `stop` for EBS-backed instances and `terminate` for instance-store instances. Cannot be set on instance-store instances. See [Shutdown Behavior](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/terminating-instances.html#Using_ChangingInstanceInitiatedShutdownBehavior) for more information.
*/
public readonly instanceInitiatedShutdownBehavior!: pulumi.Output<string>;
/**
* The state of the instance. One of: `pending`, `running`, `shutting-down`, `terminated`, `stopping`, `stopped`. See [Instance Lifecycle](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-lifecycle.html) for more information.
*/
public /*out*/ readonly instanceState!: pulumi.Output<string>;
/**
* The instance type to use for the instance. Updates to this field will trigger a stop/start of the EC2 instance.
*/
public readonly instanceType!: pulumi.Output<string>;
/**
* A number of IPv6 addresses to associate with the primary network interface. Amazon EC2 chooses the IPv6 addresses from the range of your subnet.
*/
public readonly ipv6AddressCount!: pulumi.Output<number>;
/**
* Specify one or more IPv6 addresses from the range of the subnet to associate with the primary network interface
*/
public readonly ipv6Addresses!: pulumi.Output<string[]>;
/**
* Key name of the Key Pair to use for the instance; which can be managed using the `aws.ec2.KeyPair` resource.
*/
public readonly keyName!: pulumi.Output<string>;
/**
* 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.
*/
public readonly launchTemplate!: pulumi.Output<outputs.ec2.InstanceLaunchTemplate | undefined>;
/**
* Customize the metadata options of the instance. See Metadata Options below for more details.
*/
public readonly metadataOptions!: pulumi.Output<outputs.ec2.InstanceMetadataOptions>;
/**
* If true, the launched EC2 instance will have detailed monitoring enabled. (Available since v0.6.0)
*/
public readonly monitoring!: pulumi.Output<boolean>;
/**
* Customize network interfaces to be attached at instance boot time. See Network Interfaces below for more details.
*/
public readonly networkInterfaces!: pulumi.Output<outputs.ec2.InstanceNetworkInterface[]>;
/**
* The ARN of the Outpost the instance is assigned to.
*/
public /*out*/ readonly outpostArn!: pulumi.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 `getPasswordData` is true. Note that this encrypted value will be stored in the state file, as with all exported attributes. See [GetPasswordData](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_GetPasswordData.html) for more information.
*/
public /*out*/ readonly passwordData!: pulumi.Output<string>;
/**
* Placement Group to start the instance in.
*/
public readonly placementGroup!: pulumi.Output<string>;
/**
* The number of the partition the instance is in. Valid only if the `aws.ec2.PlacementGroup` resource's `strategy` argument is set to `"partition"`.
*/
public readonly placementPartitionNumber!: pulumi.Output<number>;
/**
* The ID of the instance's primary network interface.
*/
public /*out*/ readonly primaryNetworkInterfaceId!: pulumi.Output<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 /*out*/ readonly privateDns!: pulumi.Output<string>;
/**
* Private IP address to associate with the instance in a VPC.
*/
public readonly privateIp!: pulumi.Output<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 /*out*/ readonly publicDns!: pulumi.Output<string>;
/**
* The public IP address assigned to the instance, if applicable. **NOTE**: If you are using an `aws.ec2.Eip` with your instance, you should refer to the EIP's address directly and not use `publicIp` as this field will change after the EIP is attached.
*/
public /*out*/ readonly publicIp!: pulumi.Output<string>;
/**
* 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.
*/
public readonly rootBlockDevice!: pulumi.Output<outputs.ec2.InstanceRootBlockDevice>;
/**
* A 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 `networkInterface` block. Refer to the [Elastic network interfaces documentation](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-eni.html#AvailableIpPerENI) to see the maximum number of private IP addresses allowed per instance type.
*/
public readonly secondaryPrivateIps!: pulumi.Output<string[]>;
/**
* A list of security group names to associate with.
*
* @deprecated Use of `securityGroups` is discouraged as it does not allow for changes and will force your instance to be replaced if changes are made. To avoid this, use `vpcSecurityGroupIds` which allows for updates.
*/
public readonly securityGroups!: pulumi.Output<string[]>;
/**
* Controls if traffic is routed to the instance when the destination address does not match the instance. Used for NAT or VPNs. Defaults true.
*/
public readonly sourceDestCheck!: pulumi.Output<boolean | undefined>;
/**
* VPC Subnet ID to launch in.
*/
public readonly subnetId!: pulumi.Output<string>;
/**
* A 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 `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
*/
public readonly tags!: pulumi.Output<{[key: string]: string} | undefined>;
/**
* A map of tags assigned to the resource, including those inherited from the provider.
*/
public /*out*/ readonly tagsAll!: pulumi.Output<{[key: string]: string}>;
/**
* 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.
*/
public readonly tenancy!: pulumi.Output<string>;
/**
* User data to provide when launching the instance. Do not pass gzip-compressed data via this argument; see `userDataBase64` instead.
*/
public readonly userData!: pulumi.Output<string>;
/**
* Can be used instead of `userData` to pass base64-encoded binary data directly. Use this instead of `userData` whenever 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.
*/
public readonly userDataBase64!: pulumi.Output<string>;
/**
* A map of tags to assign, at instance-creation time, to root and EBS volumes.
*/
public readonly volumeTags!: pulumi.Output<{[key: string]: string} | undefined>;
/**
* A list of security group IDs to associate with.
*/
public readonly vpcSecurityGroupIds!: pulumi.Output<string[]>;
/**
* Create a Instance resource with the given unique name, arguments, and options.
*
* @param name The _unique_ name of the resource.
* @param args The arguments to use to populate this resource's properties.
* @param opts A bag of options that control this resource's behavior.
*/
constructor(name: string, args?: InstanceArgs, opts?: pulumi.CustomResourceOptions)
constructor(name: string, argsOrState?: InstanceArgs | InstanceState, opts?: pulumi.CustomResourceOptions) {
let inputs: pulumi.Inputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState as InstanceState | undefined;
inputs["ami"] = state ? state.ami : undefined;
inputs["arn"] = state ? state.arn : undefined;
inputs["associatePublicIpAddress"] = state ? state.associatePublicIpAddress : undefined;
inputs["availabilityZone"] = state ? state.availabilityZone : undefined;
inputs["capacityReservationSpecification"] = state ? state.capacityReservationSpecification : undefined;
inputs["cpuCoreCount"] = state ? state.cpuCoreCount : undefined;
inputs["cpuThreadsPerCore"] = state ? state.cpuThreadsPerCore : undefined;
inputs["creditSpecification"] = state ? state.creditSpecification : undefined;
inputs["disableApiTermination"] = state ? state.disableApiTermination : undefined;
inputs["ebsBlockDevices"] = state ? state.ebsBlockDevices : undefined;
inputs["ebsOptimized"] = state ? state.ebsOptimized : undefined;
inputs["enclaveOptions"] = state ? state.enclaveOptions : undefined;
inputs["ephemeralBlockDevices"] = state ? state.ephemeralBlockDevices : undefined;
inputs["getPasswordData"] = state ? state.getPasswordData : undefined;
inputs["hibernation"] = state ? state.hibernation : undefined;
inputs["hostId"] = state ? state.hostId : undefined;
inputs["iamInstanceProfile"] = state ? state.iamInstanceProfile : undefined;
inputs["instanceInitiatedShutdownBehavior"] = state ? state.instanceInitiatedShutdownBehavior : undefined;
inputs["instanceState"] = state ? state.instanceState : undefined;
inputs["instanceType"] = state ? state.instanceType : undefined;
inputs["ipv6AddressCount"] = state ? state.ipv6AddressCount : undefined;
inputs["ipv6Addresses"] = state ? state.ipv6Addresses : undefined;
inputs["keyName"] = state ? state.keyName : undefined;
inputs["launchTemplate"] = state ? state.launchTemplate : undefined;
inputs["metadataOptions"] = state ? state.metadataOptions : undefined;
inputs["monitoring"] = state ? state.monitoring : undefined;
inputs["networkInterfaces"] = state ? state.networkInterfaces : undefined;
inputs["outpostArn"] = state ? state.outpostArn : undefined;
inputs["passwordData"] = state ? state.passwordData : undefined;
inputs["placementGroup"] = state ? state.placementGroup : undefined;
inputs["placementPartitionNumber"] = state ? state.placementPartitionNumber : undefined;
inputs["primaryNetworkInterfaceId"] = state ? state.primaryNetworkInterfaceId : undefined;
inputs["privateDns"] = state ? state.privateDns : undefined;
inputs["privateIp"] = state ? state.privateIp : undefined;
inputs["publicDns"] = state ? state.publicDns : undefined;
inputs["publicIp"] = state ? state.publicIp : undefined;
inputs["rootBlockDevice"] = state ? state.rootBlockDevice : undefined;
inputs["secondaryPrivateIps"] = state ? state.secondaryPrivateIps : undefined;
inputs["securityGroups"] = state ? state.securityGroups : undefined;
inputs["sourceDestCheck"] = state ? state.sourceDestCheck : undefined;
inputs["subnetId"] = state ? state.subnetId : undefined;
inputs["tags"] = state ? state.tags : undefined;
inputs["tagsAll"] = state ? state.tagsAll : undefined;
inputs["tenancy"] = state ? state.tenancy : undefined;
inputs["userData"] = state ? state.userData : undefined;
inputs["userDataBase64"] = state ? state.userDataBase64 : undefined;
inputs["volumeTags"] = state ? state.volumeTags : undefined;
inputs["vpcSecurityGroupIds"] = state ? state.vpcSecurityGroupIds : undefined;
} else {
const args = argsOrState as InstanceArgs | undefined;
inputs["ami"] = args ? args.ami : undefined;
inputs["associatePublicIpAddress"] = args ? args.associatePublicIpAddress : undefined;
inputs["availabilityZone"] = args ? args.availabilityZone : undefined;
inputs["capacityReservationSpecification"] = args ? args.capacityReservationSpecification : undefined;
inputs["cpuCoreCount"] = args ? args.cpuCoreCount : undefined;
inputs["cpuThreadsPerCore"] = args ? args.cpuThreadsPerCore : undefined;
inputs["creditSpecification"] = args ? args.creditSpecification : undefined;
inputs["disableApiTermination"] = args ? args.disableApiTermination : undefined;
inputs["ebsBlockDevices"] = args ? args.ebsBlockDevices : undefined;
inputs["ebsOptimized"] = args ? args.ebsOptimized : undefined;
inputs["enclaveOptions"] = args ? args.enclaveOptions : undefined;
inputs["ephemeralBlockDevices"] = args ? args.ephemeralBlockDevices : undefined;
inputs["getPasswordData"] = args ? args.getPasswordData : undefined;
inputs["hibernation"] = args ? args.hibernation : undefined;
inputs["hostId"] = args ? args.hostId : undefined;
inputs["iamInstanceProfile"] = args ? args.iamInstanceProfile : undefined;
inputs["instanceInitiatedShutdownBehavior"] = args ? args.instanceInitiatedShutdownBehavior : undefined;
inputs["instanceType"] = args ? args.instanceType : undefined;
inputs["ipv6AddressCount"] = args ? args.ipv6AddressCount : undefined;
inputs["ipv6Addresses"] = args ? args.ipv6Addresses : undefined;
inputs["keyName"] = args ? args.keyName : undefined;
inputs["launchTemplate"] = args ? args.launchTemplate : undefined;
inputs["metadataOptions"] = args ? args.metadataOptions : undefined;
inputs["monitoring"] = args ? args.monitoring : undefined;
inputs["networkInterfaces"] = args ? args.networkInterfaces : undefined;
inputs["placementGroup"] = args ? args.placementGroup : undefined;
inputs["placementPartitionNumber"] = args ? args.placementPartitionNumber : undefined;
inputs["privateIp"] = args ? args.privateIp : undefined;
inputs["rootBlockDevice"] = args ? args.rootBlockDevice : undefined;
inputs["secondaryPrivateIps"] = args ? args.secondaryPrivateIps : undefined;
inputs["securityGroups"] = args ? args.securityGroups : undefined;
inputs["sourceDestCheck"] = args ? args.sourceDestCheck : undefined;
inputs["subnetId"] = args ? args.subnetId : undefined;
inputs["tags"] = args ? args.tags : undefined;
inputs["tenancy"] = args ? args.tenancy : undefined;
inputs["userData"] = args ? args.userData : undefined;
inputs["userDataBase64"] = args ? args.userDataBase64 : undefined;
inputs["volumeTags"] = args ? args.volumeTags : undefined;
inputs["vpcSecurityGroupIds"] = args ? args.vpcSecurityGroupIds : undefined;
inputs["arn"] = undefined /*out*/;
inputs["instanceState"] = undefined /*out*/;
inputs["outpostArn"] = undefined /*out*/;
inputs["passwordData"] = undefined /*out*/;
inputs["primaryNetworkInterfaceId"] = undefined /*out*/;
inputs["privateDns"] = undefined /*out*/;
inputs["publicDns"] = undefined /*out*/;
inputs["publicIp"] = undefined /*out*/;
inputs["tagsAll"] = undefined /*out*/;
}
if (!opts.version) {
opts = pulumi.mergeOptions(opts, { version: utilities.getVersion()});
}
super(Instance.__pulumiType, name, inputs, opts);
}
}
/**
* Input properties used for looking up and filtering Instance resources.
*/
export interface InstanceState {
/**
* AMI to use for the instance. Required unless `launchTemplate` is specified and the Launch Template specifes an AMI. If an AMI is specified in the Launch Template, setting `ami` will override the AMI specified in the Launch Template.
*/
ami?: pulumi.Input<string>;
/**
* The ARN of the instance.
*/
arn?: pulumi.Input<string>;
/**
* Whether to associate a public IP address with an instance in a VPC.
*/
associatePublicIpAddress?: pulumi.Input<boolean>;
/**
* AZ to start the instance in.
*/
availabilityZone?: pulumi.Input<string>;
/**
* Describes an instance's Capacity Reservation targeting option. See Capacity Reservation Specification below for more details.
*/
capacityReservationSpecification?: pulumi.Input<inputs.ec2.InstanceCapacityReservationSpecification>;
/**
* 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](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-optimize-cpu.html#cpu-options-supported-instances-values) - specifying this option for unsupported instance types will return an error from the EC2 API.
*/
cpuCoreCount?: pulumi.Input<number>;
/**
* If set to to 1, hyperthreading is disabled on the launched instance. Defaults to 2 if not set. See [Optimizing CPU Options](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-optimize-cpu.html) for more information.
*/
cpuThreadsPerCore?: pulumi.Input<number>;
/**
* Configuration block for customizing the credit specification of the instance. See Credit Specification below for more details. the 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.
*/
creditSpecification?: pulumi.Input<inputs.ec2.InstanceCreditSpecification>;
/**
* If true, enables [EC2 Instance Termination Protection](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/terminating-instances.html#Using_ChangingDisableAPITermination).
*/
disableApiTermination?: pulumi.Input<boolean>;
/**
* 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.
*/
ebsBlockDevices?: pulumi.Input<pulumi.Input<inputs.ec2.InstanceEbsBlockDevice>[]>;
/**
* 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](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSOptimized.html) of the AWS User Guide for more information.
*/
ebsOptimized?: pulumi.Input<boolean>;
/**
* Enable Nitro Enclaves on launched instances. See Enclave Options below for more details.
*/
enclaveOptions?: pulumi.Input<inputs.ec2.InstanceEnclaveOptions>;
/**
* 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.
*/
ephemeralBlockDevices?: pulumi.Input<pulumi.Input<inputs.ec2.InstanceEphemeralBlockDevice>[]>;
/**
* 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 `passwordData` attribute. See [GetPasswordData](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_GetPasswordData.html) for more information.
*/
getPasswordData?: pulumi.Input<boolean>;
/**
* If true, the launched EC2 instance will support hibernation.
*/
hibernation?: pulumi.Input<boolean>;
/**
* 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.
*/
hostId?: pulumi.Input<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](http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use_switch-role-ec2.html#roles-usingrole-ec2instance-permissions), notably `iam:PassRole`.
*/
iamInstanceProfile?: pulumi.Input<string | InstanceProfile>;
/**
* Shutdown behavior for the instance. Amazon defaults this to `stop` for EBS-backed instances and `terminate` for instance-store instances. Cannot be set on instance-store instances. See [Shutdown Behavior](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/terminating-instances.html#Using_ChangingInstanceInitiatedShutdownBehavior) for more information.
*/
instanceInitiatedShutdownBehavior?: pulumi.Input<string>;
/**
* The state of the instance. One of: `pending`, `running`, `shutting-down`, `terminated`, `stopping`, `stopped`. See [Instance Lifecycle](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-lifecycle.html) for more information.
*/
instanceState?: pulumi.Input<string>;
/**
* The instance type to use for the instance. Updates to this field will trigger a stop/start of the EC2 instance.
*/
instanceType?: pulumi.Input<string | enums.ec2.InstanceType>;
/**
* A number of IPv6 addresses to associate with the primary network interface. Amazon EC2 chooses the IPv6 addresses from the range of your subnet.
*/
ipv6AddressCount?: pulumi.Input<number>;
/**
* Specify one or more IPv6 addresses from the range of the subnet to associate with the primary network interface
*/
ipv6Addresses?: pulumi.Input<pulumi.Input<string>[]>;
/**
* Key name of the Key Pair to use for the instance; which can be managed using the `aws.ec2.KeyPair` resource.
*/
keyName?: pulumi.Input<string>;
/**
* 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.
*/
launchTemplate?: pulumi.Input<inputs.ec2.InstanceLaunchTemplate>;
/**
* Customize the metadata options of the instance. See Metadata Options below for more details.
*/
metadataOptions?: pulumi.Input<inputs.ec2.InstanceMetadataOptions>;
/**
* If true, the launched EC2 instance will have detailed monitoring enabled. (Available since v0.6.0)
*/
monitoring?: pulumi.Input<boolean>;
/**
* Customize network interfaces to be attached at instance boot time. See Network Interfaces below for more details.
*/
networkInterfaces?: pulumi.Input<pulumi.Input<inputs.ec2.InstanceNetworkInterface>[]>;
/**
* The ARN of the Outpost the instance is assigned to.
*/
outpostArn?: pulumi.Input<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 `getPasswordData` is true. Note that this encrypted value will be stored in the state file, as with all exported attributes. See [GetPasswordData](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_GetPasswordData.html) for more information.
*/
passwordData?: pulumi.Input<string>;
/**
* Placement Group to start the instance in.
*/
placementGroup?: pulumi.Input<string>;
/**
* The number of the partition the instance is in. Valid only if the `aws.ec2.PlacementGroup` resource's `strategy` argument is set to `"partition"`.
*/
placementPartitionNumber?: pulumi.Input<number>;
/**
* The ID of the instance's primary network interface.
*/
primaryNetworkInterfaceId?: pulumi.Input<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.
*/
privateDns?: pulumi.Input<string>;
/**
* Private IP address to associate with the instance in a VPC.
*/
privateIp?: pulumi.Input<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.
*/
publicDns?: pulumi.Input<string>;
/**
* The public IP address assigned to the instance, if applicable. **NOTE**: If you are using an `aws.ec2.Eip` with your instance, you should refer to the EIP's address directly and not use `publicIp` as this field will change after the EIP is attached.
*/
publicIp?: pulumi.Input<string>;
/**
* 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.
*/
rootBlockDevice?: pulumi.Input<inputs.ec2.InstanceRootBlockDevice>;
/**
* A 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 `networkInterface` block. Refer to the [Elastic network interfaces documentation](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-eni.html#AvailableIpPerENI) to see the maximum number of private IP addresses allowed per instance type.
*/
secondaryPrivateIps?: pulumi.Input<pulumi.Input<string>[]>;
/**
* A list of security group names to associate with.
*
* @deprecated Use of `securityGroups` is discouraged as it does not allow for changes and will force your instance to be replaced if changes are made. To avoid this, use `vpcSecurityGroupIds` which allows for updates.
*/
securityGroups?: pulumi.Input<pulumi.Input<string>[]>;
/**
* Controls if traffic is routed to the instance when the destination address does not match the instance. Used for NAT or VPNs. Defaults true.
*/
sourceDestCheck?: pulumi.Input<boolean>;
/**
* VPC Subnet ID to launch in.
*/
subnetId?: pulumi.Input<string>;
/**
* A 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 `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
*/
tags?: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
/**
* A map of tags assigned to the resource, including those inherited from the provider.
*/
tagsAll?: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
/**
* 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.
*/
tenancy?: pulumi.Input<string | enums.ec2.Tenancy>;
/**
* User data to provide when launching the instance. Do not pass gzip-compressed data via this argument; see `userDataBase64` instead.
*/
userData?: pulumi.Input<string>;
/**
* Can be used instead of `userData` to pass base64-encoded binary data directly. Use this instead of `userData` whenever 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.
*/
userDataBase64?: pulumi.Input<string>;
/**
* A map of tags to assign, at instance-creation time, to root and EBS volumes.
*/
volumeTags?: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
/**
* A list of security group IDs to associate with.
*/
vpcSecurityGroupIds?: pulumi.Input<pulumi.Input<string>[]>;
}
/**
* The set of arguments for constructing a Instance resource.
*/
export interface InstanceArgs {
/**
* AMI to use for the instance. Required unless `launchTemplate` is specified and the Launch Template specifes an AMI. If an AMI is specified in the Launch Template, setting `ami` will override the AMI specified in the Launch Template.
*/
ami?: pulumi.Input<string>;
/**
* Whether to associate a public IP address with an instance in a VPC.
*/
associatePublicIpAddress?: pulumi.Input<boolean>;
/**
* AZ to start the instance in.
*/
availabilityZone?: pulumi.Input<string>;
/**
* Describes an instance's Capacity Reservation targeting option. See Capacity Reservation Specification below for more details.
*/
capacityReservationSpecification?: pulumi.Input<inputs.ec2.InstanceCapacityReservationSpecification>;
/**
* 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](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-optimize-cpu.html#cpu-options-supported-instances-values) - specifying this option for unsupported instance types will return an error from the EC2 API.
*/
cpuCoreCount?: pulumi.Input<number>;
/**
* If set to to 1, hyperthreading is disabled on the launched instance. Defaults to 2 if not set. See [Optimizing CPU Options](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-optimize-cpu.html) for more information.
*/
cpuThreadsPerCore?: pulumi.Input<number>;
/**
* Configuration block for customizing the credit specification of the instance. See Credit Specification below for more details. the 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.
*/
creditSpecification?: pulumi.Input<inputs.ec2.InstanceCreditSpecification>;
/**
* If true, enables [EC2 Instance Termination Protection](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/terminating-instances.html#Using_ChangingDisableAPITermination).
*/
disableApiTermination?: pulumi.Input<boolean>;
/**
* 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.
*/
ebsBlockDevices?: pulumi.Input<pulumi.Input<inputs.ec2.InstanceEbsBlockDevice>[]>;
/**
* 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](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSOptimized.html) of the AWS User Guide for more information.
*/
ebsOptimized?: pulumi.Input<boolean>;
/**
* Enable Nitro Enclaves on launched instances. See Enclave Options below for more details.
*/
enclaveOptions?: pulumi.Input<inputs.ec2.InstanceEnclaveOptions>;
/**
* 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.
*/
ephemeralBlockDevices?: pulumi.Input<pulumi.Input<inputs.ec2.InstanceEphemeralBlockDevice>[]>;
/**
* 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 `passwordData` attribute. See [GetPasswordData](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_GetPasswordData.html) for more information.
*/
getPasswordData?: pulumi.Input<boolean>;
/**
* If true, the launched EC2 instance will support hibernation.
*/
hibernation?: pulumi.Input<boolean>;
/**
* 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.
*/
hostId?: pulumi.Input<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](http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use_switch-role-ec2.html#roles-usingrole-ec2instance-permissions), notably `iam:PassRole`.
*/
iamInstanceProfile?: pulumi.Input<string | InstanceProfile>;
/**
* Shutdown behavior for the instance. Amazon defaults this to `stop` for EBS-backed instances and `terminate` for instance-store instances. Cannot be set on instance-store instances. See [Shutdown Behavior](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/terminating-instances.html#Using_ChangingInstanceInitiatedShutdownBehavior) for more information.
*/
instanceInitiatedShutdownBehavior?: pulumi.Input<string>;
/**
* The instance type to use for the instance. Updates to this field will trigger a stop/start of the EC2 instance.
*/
instanceType?: pulumi.Input<string | enums.ec2.InstanceType>;
/**
* A number of IPv6 addresses to associate with the primary network interface. Amazon EC2 chooses the IPv6 addresses from the range of your subnet.
*/
ipv6AddressCount?: pulumi.Input<number>;
/**
* Specify one or more IPv6 addresses from the range of the subnet to associate with the primary network interface
*/
ipv6Addresses?: pulumi.Input<pulumi.Input<string>[]>;
/**
* Key name of the Key Pair to use for the instance; which can be managed using the `aws.ec2.KeyPair` resource.
*/
keyName?: pulumi.Input<string>;
/**
* 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.
*/
launchTemplate?: pulumi.Input<inputs.ec2.InstanceLaunchTemplate>;
/**
* Customize the metadata options of the instance. See Metadata Options below for more details.
*/
metadataOptions?: pulumi.Input<inputs.ec2.InstanceMetadataOptions>;
/**
* If true, the launched EC2 instance will have detailed monitoring enabled. (Available since v0.6.0)
*/
monitoring?: pulumi.Input<boolean>;
/**
* Customize network interfaces to be attached at instance boot time. See Network Interfaces below for more details.
*/
networkInterfaces?: pulumi.Input<pulumi.Input<inputs.ec2.InstanceNetworkInterface>[]>;
/**
* Placement Group to start the instance in.
*/
placementGroup?: pulumi.Input<string>;
/**
* The number of the partition the instance is in. Valid only if the `aws.ec2.PlacementGroup` resource's `strategy` argument is set to `"partition"`.
*/
placementPartitionNumber?: pulumi.Input<number>;
/**
* Private IP address to associate with the instance in a VPC.
*/
privateIp?: pulumi.Input<string>;
/**
* 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.
*/
rootBlockDevice?: pulumi.Input<inputs.ec2.InstanceRootBlockDevice>;
/**
* A 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 `networkInterface` block. Refer to the [Elastic network interfaces documentation](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-eni.html#AvailableIpPerENI) to see the maximum number of private IP addresses allowed per instance type.
*/
secondaryPrivateIps?: pulumi.Input<pulumi.Input<string>[]>;
/**
* A list of security group names to associate with.
*
* @deprecated Use of `securityGroups` is discouraged as it does not allow for changes and will force your instance to be replaced if changes are made. To avoid this, use `vpcSecurityGroupIds` which allows for updates.
*/
securityGroups?: pulumi.Input<pulumi.Input<string>[]>;
/**
* Controls if traffic is routed to the instance when the destination address does not match the instance. Used for NAT or VPNs. Defaults true.
*/
sourceDestCheck?: pulumi.Input<boolean>;
/**
* VPC Subnet ID to launch in.
*/
subnetId?: pulumi.Input<string>;
/**
* A 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 `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
*/
tags?: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
/**
* 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.
*/
tenancy?: pulumi.Input<string | enums.ec2.Tenancy>;
/**
* User data to provide when launching the instance. Do not pass gzip-compressed data via this argument; see `userDataBase64` instead.
*/
userData?: pulumi.Input<string>;
/**
* Can be used instead of `userData` to pass base64-encoded binary data directly. Use this instead of `userData` whenever 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.
*/
userDataBase64?: pulumi.Input<string>;
/**
* A map of tags to assign, at instance-creation time, to root and EBS volumes.
*/
volumeTags?: pulumi.Input<{[key: string]: pulumi.Input<string>}>;
/**
* A list of security group IDs to associate with.
*/
vpcSecurityGroupIds?: pulumi.Input<pulumi.Input<string>[]>;
}