Boto3 CloudFormation 状态
Boto3 CloudFormation Status
是否可以获取 CloudFormation 堆栈的状态?如果是,怎么做?
我正在创建一个堆栈:
client = boto3.client('cloudformation',)
response = client.create_stack(
StackName=stackname,
...
)
我可以在 CloudFormation web UI 中看到堆栈已成功创建。
我尝试通过以下方式获取状态:
print(client.describe_stacks(stack_name_or_id=hostname))
但这会引发异常:
botocore.exceptions.ParamValidationError: Parameter validation failed:
Unknown parameter in input: "stack_name_or_id", must be one of: StackName, NextToken
所以我尝试等待堆栈部署并捕获异常:
while True:
time.sleep(5)
try:
print(client.describe_stacks(stack_name_or_id=stackname))
except botocore.exceptions.ParamValidationError:
pass
但是我一点反应都没有; print
语句永远不会被调用。
错误信息:
Unknown parameter in input: "stack_name_or_id", must be one of: StackName, NextToken
明确表示您传递的参数名称无效; stack_name_or_id
.
在Boto3 describe_stacks中,期望参数为:StackName
response = client.describe_stacks(
StackName='string',
NextToken='string'
)
对于 运行 堆栈,您可以传递堆栈名称或堆栈 ID。但是对于删除的堆栈,你必须传递堆栈ID。
client.describe_stacks(StackName='mystack')
{u'Stacks': [{u'StackId': 'arn:aws:cloudformation:us-east-1:.......
'content-type': 'text/xml',
'date': 'Thu, 22 Jun 2017 14:54:46 GMT'}}}
是否可以获取 CloudFormation 堆栈的状态?如果是,怎么做?
我正在创建一个堆栈:
client = boto3.client('cloudformation',)
response = client.create_stack(
StackName=stackname,
...
)
我可以在 CloudFormation web UI 中看到堆栈已成功创建。
我尝试通过以下方式获取状态:
print(client.describe_stacks(stack_name_or_id=hostname))
但这会引发异常:
botocore.exceptions.ParamValidationError: Parameter validation failed:
Unknown parameter in input: "stack_name_or_id", must be one of: StackName, NextToken
所以我尝试等待堆栈部署并捕获异常:
while True:
time.sleep(5)
try:
print(client.describe_stacks(stack_name_or_id=stackname))
except botocore.exceptions.ParamValidationError:
pass
但是我一点反应都没有; print
语句永远不会被调用。
错误信息:
Unknown parameter in input: "stack_name_or_id", must be one of: StackName, NextToken
明确表示您传递的参数名称无效; stack_name_or_id
.
在Boto3 describe_stacks中,期望参数为:StackName
response = client.describe_stacks(
StackName='string',
NextToken='string'
)
对于 运行 堆栈,您可以传递堆栈名称或堆栈 ID。但是对于删除的堆栈,你必须传递堆栈ID。
client.describe_stacks(StackName='mystack')
{u'Stacks': [{u'StackId': 'arn:aws:cloudformation:us-east-1:.......
'content-type': 'text/xml',
'date': 'Thu, 22 Jun 2017 14:54:46 GMT'}}}