amazon-web-services - 使用 Deploy 命令的 Cloudformation CLI 参数
问题描述
我在掌握将 cli 参数与cloudformation deploy
. 我正在尝试传递我想要创建的 S3 存储桶的名称,并且当我--parameters
用来执行此操作时,cli 会抱怨:
aws cloudformation deploy --template-file ../infrastructure.yml --stack-name stripe-python --parameters ParameterKey=S3BucketNameParameter,ParameterValue=lambda-artifacts-948d01bc80800b36
usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:
aws help
aws <command> help
aws <command> <subcommand> help
aws: error: argument subcommand: Invalid choice, valid choices are:
push | register
deregister | install
显然,省略参数也不起作用:
aws cloudformation deploy --template-file ../infrastructure.yml --stack-name stripe-python
An error occurred (ValidationError) when calling the CreateChangeSet operation: Parameters: [S3BucketNameParameter] must have values
当我查看的文档时cloudformation deploy
,它似乎不支持--parameters
,而是--parameter-overrides
,我也尝试过但没有成功:
aws cloudformation deploy --template-file ../infrastructure.yml --stack-name stripe-python --parameter-overrides S3BucketNameParameter=lambda-artifacts-948d01bc80800b36
An error occurred (ValidationError) when calling the CreateChangeSet operation: Parameters: [S3BucketNameParameter] must have values
所以,我在这里有点难过。这是模板文件的内容:
cat ../infrastructure.yml
AWSTemplateFormatVersion: '2010-09-09'
Transform: 'AWS::Serverless-2016-10-31'
Description: An AWS Lambda application that calls the Stripe API to tokenize and charge credit cards
Parameters:
S3BucketNameParameter:
Type: String
Description: Bucket name for deployment artifacts
Resources:
S3Bucket:
Type: AWS::S3::Bucket
DeletionPolicy: Retain
Properties:
BucketName: !Ref S3BucketNameParameter
关于正确方法的任何建议?
解决方案
这对我有用:
aws cloudformation deploy --template-file infrastructure.yml --stack-name stripe-python --parameter-overrides S3BucketNameParameter=lambda-artifacts-948d01bc80800b36
它可能归结为 awscli 版本(即检查您正在运行的版本和文档)
aws --version
aws-cli/2.0.44 Python/3.8.5 Darwin/18.7.0 source/x86_64
推荐阅读
- c# - 如何启动 UWP 模拟器?
- reactjs - 这两种使用打字稿创建功能组件的方法有什么区别?
- node.js - 如何从 newman 获取 JSON 响应
- git - 清理 Git 中的分支历史记录
- javascript - 在将页面中直接编码的代码移动到我的站点资产以允许参数和重用方面需要帮助
- django - Django View,获取模板中的所有列表项
- c# - 在ac#程序中,如何访问可观察集合的属性?
- java - mssql-jdbc-6.3.4.jre8-preview.jar 没有 sqljdbc_auth.dll
- spring-batch - 如何重新启动面向正确位置的弹簧批处理块?
- python-3.x - 将 csv 从 s3 转换为镶木地板的 Lambda 函数