amazon-web-services - 如何解决 aws cloudformation 脚本中不支持的格式错误

标签 amazon-web-services aws-cloudformation aws-cli

我正在编写一个 cloudformation 脚本,该脚本应该从 .txt 文件中选择堆栈名称、模板主体和参数文件进行部署。我不希望在新部署期间编辑 yaml 和 json 文件,而应该编辑 .txt 文件 代码如下

aws cloudformation create-stack --stack-name $(<stack_name.txt) --template-body 
file://$(<stack_template_file_name.txt) --parameters file://$(<stack_parameter_file_name.txt) capabilities "CAPABILITY_IAM" "CAPABILITY_NAMED_IAM" --region=us-west-2

注意:stack_name.txt包含要使用的堆栈名称,stack_template_file_name.txt包含template.yml文件的名称,stack_parameter_file_name.txt包含parameter.json文件的名称

当我直接在 cli 中键入命令时,堆栈已部署,但是当我将其复制到 create.sh 并运行 ./create.sh 时,出现以下错误

`' doesn't match a supported format.`

我该如何解决这个问题?

最佳答案

我只是想发表评论,我在 aws CLI 中的另一个问题中发现了相同的错误。 ' 与支持的格式不匹配。

运行时: aws s3 cp file.txt s3://bucket-name/

该问题是由于 ~/.aws 配置文件夹。

重新运行 ~/.aws configure 命令似乎没有解决问题

但是通过检查 ~/.aws 文件夹我能够删除导致问题的随机字符。

关于amazon-web-services - 如何解决 aws cloudformation 脚本中不支持的格式错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63662446/

相关文章:

amazon-web-services - aws 描述实例查询标签

amazon-web-services - `aws logs list-tags-log-group` 时出错

amazon-web-services - CORS 击败 AWS LAMBDA :(

python - AWS lambda在每次调用时更新sts角色非常耗时

amazon-web-services - 如何在存储桶名称中使用变量 AWS Cloudformation

amazon-web-services - CloudFormation KMS 加密问题

json - 允许同一安全组中的每个实例在 Cloud Formation JSON 中相互共享任何数据吗?

python - GAE/P存储SES连接和线程安全

amazon-web-services - AWS : Is it possible to retrieve the content of key that stored in KMS?

amazon-web-services - 自动释放未使用的 Elastic IPS 的方法