简体   繁体   English

如何知道是否使用AWS Cloud SDK完全创建了堆栈

[英]How to know if the stack is completely created using AWS SDK for Cloud Formation

I am using AWS SDK and creating stacks using CloudFormation templates. 我正在使用AWS开发工具包,并使用CloudFormation模板创建堆栈。 When I call the create Stack method, it gets executed perfectly and the call back returns a StackID. 当我调用create Stack方法时,它会完美执行,并且回调返回一个StackID。 The problem here is stack is created but the resources inside the stack are still getting created and the whole create process is not completed. 这里的问题是创建了堆栈,但是仍在创建堆栈中的资源,并且整个创建过程尚未完成。 How will I know in my javascript that the whole creation process is completed? 我如何在JavaScript中知道整个创建过程已完成?

You can use a waiter for stackCreateComplete : 您可以将服务员用于stackCreateComplete

var params = {
  StackName: 'name or the unique stack ID'
};
cloudformation.waitFor('stackCreateComplete', params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM