【问题标题】:How do I specify region in aws cloud formation command line tool for windows如何在 Windows 的 aws 云形成命令行工具中指定区域
【发布时间】:2014-12-23 08:42:38
【问题描述】:

我在命令行上提交这个(我省略了我知道可以工作的所有其他参数)

aws cloudformation create-stack ... --parameters ParameterKey=Region,ParameterValue=us-east-1

它产生:

Unable to construct an endpoint for cloudformation in regionNone

如果我使用https://console.aws.amazon.com/cloudformation web ui 提交完全相同的参数,它就可以工作。

如何使用 windows 的 aws.exe 指定区域?我用作模板的 .json 文件甚至将其作为默认文件,但如果我在命令行中省略区域,它仍然不会使用它

“地区”:{ “类型”:“字符串”, "Description": "要在哪个地区启动", “默认”:“us-east-1”, “允许值”:[ “us-east-1”、“us-west-1”、“us-west-2”、“eu-west-1”、“ap-northeast-1” ] }

在调试模式下我得到...

File "awscli\clidriver.pyc", line 206, in main
File "awscli\clidriver.pyc", line 354, in __call__
File "awscli\clidriver.pyc", line 461, in __call__
File "awscli\clidriver.pyc", line 555, in invoke
File "botocore\service.pyc", line 161, in get_endpoint
File "botocore\endpoint.pyc", line 265, in create_endpoint
File "botocore\regions.pyc", line 67, in construct_endpoint
UnknownEndpointError: Unable to construct an endpoint for cloudformation in region None
2014-10-27 22:52:38,631 - MainThread - awscli.clidriver - DEBUG - Exiting with rc 255

【问题讨论】:

    标签: amazon-web-services amazon-cloudformation


    【解决方案1】:

    区域是 aws 命令的参数:

    aws --region eu-west-1 cloudformation create-stack --stack-name ...

    【讨论】:

    • 谢谢。从 Windows .bat 文件中执行此操作,我得到了这个:aws cloudformation create-stack --stack-name %STACK_NAME% --capabilities %CAPABILITIES% --template-url %TEMPLATE_URL% --region %global_region% --parameters %PARAMETERS %
    • 听起来不错。如果答案对您有用,请考虑接受它... :)
    【解决方案2】:

    您也可以使用aws configure 配置它,或者如果已经执行,您可以在~/.aws/config 中识别它。示例:

    [default]
    region=us-east-1
    

    地区如下。请参阅第二列。

    $ ec2-describe-regions
    REGION  eu-central-1    ec2.eu-central-1.amazonaws.com
    REGION  sa-east-1   ec2.sa-east-1.amazonaws.com
    REGION  ap-northeast-1  ec2.ap-northeast-1.amazonaws.com
    REGION  eu-west-1   ec2.eu-west-1.amazonaws.com
    REGION  us-east-1   ec2.us-east-1.amazonaws.com
    REGION  us-west-1   ec2.us-west-1.amazonaws.com
    REGION  us-west-2   ec2.us-west-2.amazonaws.com
    REGION  ap-southeast-2  ec2.ap-southeast-2.amazonaws.com
    REGION  ap-southeast-1  ec2.ap-southeast-1.amazonaws.com
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-10-22
      • 2022-01-14
      • 2020-11-12
      • 1970-01-01
      • 2018-06-05
      • 2017-04-03
      • 2015-10-28
      • 2018-11-18
      相关资源
      最近更新 更多