我正在使用以下AWS Cli Cloud Formation命令来创建然后执行和更改set:
aws cloudformation create-change-set --change-set-name change-set-1
aws cloudformation execute-change-set --change-set-name change-set-1
然而,第一个命令在创建更改集之前返回,如果我立即执行第二个命令则失败。
我考虑过的解决方案:
这两个都有问题。
理想情况下,create-change-set命令上有一个选项可以立即执行,或者同步运行,直到创建更改集后才返回。
有没有人试过这个并提出比我更好的解决方案?
答案 0 :(得分:3)
我还没有亲自尝试过,但也许您可以使用命令list-change-sets循环,直到您的更改集状态为 CREATE_COMPLETE ,然后执行第二个命令
希望这有帮助。
答案 1 :(得分:0)
如果您不需要创建更改集然后执行它的中间步骤(我们没有),那么使用update-stack
子命令。
aws cloudformation update-stack --stack-name myStack --template-url ...
答案 2 :(得分:-1)
我使用以下序列解决了这个问题:
import matplotlib.pyplot as plt
import pandas as pd
from scipy import stats
import numpy as np
df = pd.DataFrame(np.random.gamma(2, scale=2, size=5000),
columns=['samples'])
params = stats.gamma.fit(df.samples, loc=0)
xvals = np.linspace(0, df.samples.max())
pdf = lambda x: stats.gamma.pdf(xvals, *params)
yvals = pdf(xvals)
fig, ax1 = plt.subplots()
df.samples.hist(bins=20, ax=ax1, normed=True, label='Samples',
grid=False, edgecolor='k')
plt.plot(xvals, yvals, axes=ax1, c='r', label='Fit')
ax1.legend()
希望它会有所帮助。