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
| "use strict";
const pulumi = require("@pulumi/pulumi");
const alicloud = require("@pulumi/alicloud");
const exampleRg = new alicloud.resourcemanager.ResourceGroup("pulumiDeployment", {
displayName: "Pulumi Example RG",
// error: [ERROR] terraform-provider-alicloud@v1.176.0/alicloud/resource_alicloud_resource_manager_resource_group.go:95:
// [ERROR] Argument "name" or "resource_group_name" must be set one!
resourceGroupName: "pulumiDeployment",
});
const exampleVpc = new alicloud.vpc.Network("pulumiExampleVpc", {
description: "Pulumi Example VPC.",
resourceGroupId: exampleRg.id,
cidrBlock: "172.17.0.0/16",
});
const exampleSwitch = new alicloud.vpc.Switch("exampleSwitch", {
cidrBlock: "172.17.1.0/24",
vpcId: exampleVpc.id,
vswitchName: "xxxxx",
zoneId: "cn-shanghai-l",
}, {
protect: false,
});
/*
zoneId, string:
The AZ for the switch. Note: Required for a VPC switch.
*/
const exampleSg = new alicloud.ecs.SecurityGroup("pulumiExampleSg", {
description: "System created security group.",
innerAccessPolicy: "Accept",
vpcId: exampleVpc.id,
});
const exampleSgRule = new alicloud.ecs.SecurityGroupRule("pulumiExampleSgRule", {
description: "System created security group rules.",
ipProtocol: "all",
securityGroupId: exampleSg.id,
type: "ingress",
cidrIp: "0.0.0.0/0",
});
// Import an existing public key to build a alicloud key pair
const publickey = new alicloud.ecs.EcsKeyPair("publickey", {
keyPairName: "tian_thinkpad",
publicKey: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDN+pmQajq/WDUnbK2yvGFiiZ+CSNFYSMKcPX6k14pVGSIviQYffus4DRIXUftfwAd1EQt4xJdMrMy4eDTLhxvJ6JUbkgqu2UVjfSvTzinTc+7FOBV1VrS+CSuNcviqd0z6Kd2djuU0+zPPMFHrM+orq882fv5tewYseslwZXL6/ZzVZT0ieLEEn75KRAuk1eixT4ODq8C2RfMPVdtWkeMZvEF4qeJI1SSGR7yfyf6jowbiZtGGjbyvf//8CU1jIP7bUU4FrRjdkrnzA+XvaPRcvD4+DSrP2qQ066dzeQgeXGo6qr894lSoWSA9vTPkDTYRCNAFH1vBvDhZZsBcaX8j silas@silas-ThinkPad",
});
const exampleInstance = new alicloud.ecs.Instance("pulumiExampleInstance", {
// availabilityZone: "cn-shanghai",
availabilityZone: "cn-shanghai-l",
creditSpecification: "Standard",
imageId: "aliyun_3_x64_20G_alibase_20220527.vhd",
instanceChargeType: "PostPaid",
instanceType: "ecs.t6-c2m1.large",
internetChargeType: "PayByTraffic",
internetMaxBandwidthOut: 100,
keyName: "tian_thinkpad",
resourceGroupId: exampleRg.id,
securityGroups: [exampleSg.id],
spotStrategy: "NoSpot",
status: "Running",
stoppedMode: "StopCharging",
systemDiskCategory: "cloud_essd",
systemDiskPerformanceLevel: "PL0",
tags: {
company: "pulumi",
},
volumeTags: {
company: "pulumi",
},
vswitchId: exampleSwitch.id,
});
/*
hostName: Host name of the ECS, which is a string of at least two characters. “hostname” cannot start or end with “.” or “-“.
autoReleaseTime:
The automatic release time of the PostPaid instance. The time follows the ISO 8601 standard and is in UTC time. Format: yyyy-MM-ddTHH:mm:ssZ. It must be at least half an hour later than the current time and less than 3 years since the current time. Set it to null can cancel automatic release attribute and the ECS instance will not be released automatically.
instanceChargeType:
Valid values are PrePaid, PostPaid, The default is PostPaid.
internetChargeType:
Internet charge type of the instance, Valid values are PayByBandwidth, PayByTraffic. Default is PayByTraffic. At present, 'PrePaid' instance cannot change the value to "PayByBandwidth" from "PayByTraffic".
internetMaxBandwidthOut:
Maximum outgoing bandwidth to the public network, measured in Mbps (Mega bit per second). Value range: [0, 100]. Default to 0 Mbps.
keyName:
The name of key pair that can login ECS instance successfully without password. If it is specified, the password would be invalid.
password:
Password to an instance is a string of 8 to 30 characters. It must contain uppercase/lowercase letters and numerals, but cannot contain special symbols. When it is changed, the instance will reboot to make the change take effect.
availabilityZone:
The Zone to start the instance in. It is ignored and will be computed when set vswitch_id.
dataDisks:
InstanceDataDiskArgs[]
The list of data disks created with instance.
creditSpecification:
Performance mode of the t5 burstable instance. Valid values: 'Standard', 'Unlimited'.
spotDuration, number:
The retention time of the preemptive instance in hours. Valid values: 0, 1, 2, 3, 4, 5, 6. Retention duration 2~6 is under invitation test, please submit a work order if you need to open. If the value is 0, the mode is no protection period. Default value is 1.
spotPriceLimit, number:
The hourly price threshold of a instance, and it takes effect only when parameter 'spot_strategy' is 'SpotWithPriceLimit'. Three decimals is allowed at most.
spotStrategy:
The spot strategy of a Pay-As-You-Go instance, and it takes effect only when parameter instance_charge_type is 'PostPaid'. Value range:
- NoSpot: A regular Pay-As-You-Go instance.
- SpotWithPriceLimit: A price threshold for a spot instance
- SpotAsPriceGo: A price that is based on the highest Pay-As-You-Go instance
status:
The instance status. Valid values: ["Running", "Stopped"]. You can control the instance start and stop through this parameter. Default to Running.
stoppedMode:
The stop mode of the pay-as-you-go instance. Valid values: StopCharging,KeepCharging, Not-applicable. Default value: If the prerequisites required for enabling the economical mode are met, and you have enabled this mode in the ECS console, the default value is StopCharging.
systemDiskCategory:
Valid values are ephemeral_ssd, cloud_efficiency, cloud_ssd, cloud_essd, cloud, cloud_auto. only is used to some none I/O optimized instance. Default to cloud_efficiency. Valid values cloud_auto Available in 1.184.0+.
systemDiskPerformanceLevel:
The performance level of the ESSD used as the system disk, Valid values: PL0, PL1, PL2, PL3, Default to PL1;For more information about ESSD, See Encryption Context.
systemDiskSize:
Size of the system disk, measured in GiB. Value range: [20, 500]. The specified value must be equal to or greater than max{20, Imagesize}. Default value: max{40, ImageSize}.
Outputs:
- id, string:
The provider-assigned unique ID for this managed resource.
- publicIp, string:
The instance public ip.
*/
exports.publicIp = exampleInstance.publicIp;
|