本文整理汇总了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());