【发布时间】:2021-06-27 00:20:09
【问题描述】:
我有一个最初从 CloudFormation 模板创建的堆栈。当我将文件保存到我的 s3 存储桶时,我需要在 node.js 中添加一些动态标签。这是我的代码。
let date = new Date();
let currentDate = date.toISOString();
let cloudFormationParams = {
StackName: 'name-of-stack-created-from-cloud-formation',
Tags: [
{
Key: 'CurrentDate',
Value: currentDate
},
/* more items */
],
UsePreviousTemplate: true
};
await cloudformation.updateStack(cloudFormationParams, (err, data) => {
if (err) {
console.log(err, err.stack); // an error occurred
return { status: "error" }
} else {
console.log(data); // successful response
}
}).promise();
这给了我错误 "ValidationError","errorMessage":"Stack: is in UPDATE_IN_PROGRESS state and can't be updated.
谁能告诉我我做错了什么?
【问题讨论】:
-
此错误仅表示您的堆栈当前正在更新中....等到您的堆栈处于最终状态(以 COMPLETE 或 FAILED 结尾)并重试
-
为了解决这个问题,我试图调用一个函数来将每个文件保存在一个 for 循环中。此函数包含更新堆栈的代码。为循环中的第一个文件正确添加了标签,但之后的所有文件都会生成错误。
标签: node.js amazon-web-services aws-lambda amazon-cloudformation