【发布时间】:2020-05-15 01:05:27
【问题描述】:
我正在尝试向我的 AWS Spot 请求添加标签。但它返回了我{ UnexpectedParameter: Unexpected key 'TagSpecifications' found in params.LaunchSpecification。
我关注了this documentation,并且已经尝试将此代码移出LaunchSpecification,但错误仍然存在。
const params = {
InstanceCount: 1,
LaunchSpecification: {
ImageId: config.aws.instanceAMI,
KeyName: 'backoffice',
InstanceType: config.aws.instanceType,
SecurityGroupIds: [config.aws.instanceSecurityGroupId],
TagSpecifications: [{
ResourceType: 'instance',
Tags: [{
Key: 'Type',
Value: 'Mongo-Dump',
}],
}],
BlockDeviceMappings: [{
DeviceName: '/dev/xvda',
Ebs: {
DeleteOnTermination: true,
SnapshotId: 'snap-06e838ce2a80337a4',
VolumeSize: 50,
VolumeType: 'gp2',
Encrypted: false,
},
}],
IamInstanceProfile: {
Name: config.aws.instanceProfileIAMName,
},
Placement: {
AvailabilityZone: `${config.aws.region}a`,
},
},
SpotPrice: config.aws.instancePrice,
Type: 'one-time',
};
return ec2.requestSpotInstances(params).promise();
有些事情让我认为问题出在文档或 Javascript 本身的 aws-sdk 中。我的选择已经用尽了。
【问题讨论】:
标签: node.js amazon-web-services aws-sdk