本文整理匯總了TypeScript中aws-sdk.EC2類的典型用法代碼示例。如果您正苦於以下問題:TypeScript EC2類的具體用法?TypeScript EC2怎麽用?TypeScript EC2使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了EC2類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: _getDefaultVPC
_getDefaultVPC() {
let vpcFilter;
this._ec2 = new this._AWS.EC2();
return this._ec2
.describeVpcs()
.promise()
.then(res => {
for (let i in res.Vpcs) {
if (res.Vpcs[i].IsDefault) {
this._vpc = res.Vpcs[i].VpcId;
break;
}
}
vpcFilter = {
Filters: [
{
Name: "vpc-id",
Values: [this._vpc]
}
]
};
return this._ec2.describeSubnets(vpcFilter).promise();
})
.then(res => {
this._subnets = [];
for (let i in res.Subnets) {
this._subnets.push(res.Subnets[i].SubnetId);
}
return Promise.resolve();
});
}
示例2: retryx
const describeImagesResult = await retryx(() => ec2.describeImages({
Owners: ['self'],
Filters: [
{
Name: 'state',
Values: ['available'],
},
{
Name: 'tag-key',
Values: [tagKey],
}
],
}).promise());
示例3:
.then(res => {
for (let i in res.Vpcs) {
if (res.Vpcs[i].IsDefault) {
this._vpc = res.Vpcs[i].VpcId;
break;
}
}
vpcFilter = {
Filters: [
{
Name: "vpc-id",
Values: [this._vpc]
}
]
};
return this._ec2.describeSubnets(vpcFilter).promise();
})
示例4: retryx
const describeInstancesResult = await retryx(() => ec2.describeInstances({
NextToken: nextToken,
Filters: [
{
Name: 'instance-state-name',
Values: [
'running',
'stopping',
'stopped',
],
},
{
Name: 'tag-key',
Values: [tagKey],
},
]
}).promise());