2014-10-28 33 views
7

我提交此命令行(我省略了所有其他PARAMS,我知道工作)如何在AWS雲的形成命令行工具指定區域的Windows

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網絡用戶界面提交完全相同的參數,可以很有效。

我如何使用aws.exe爲windows指定區域?我作爲模板使用以.json文件甚至有它作爲默認,但它仍然沒有考慮它,如果我在命令行

「地區」忽略區域:{ 「類型」:「字符串」, 「說明」:「要啓動哪個區域」, 「默認」:「us-east-1」, 「AllowedValues」:[ 「us-east-1」,「us-west-1」,「us -West-2" , 「歐盟 - 西-1」, 「AP-東北-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 

回答

9

該地區是AWS命令的參數:

AWS --region歐盟 - 西1 cloudformation創建堆棧--stack名...

+0

謝謝。從.bat文件窗口做,我已經到了這個: 'AWS cloudformation創建堆棧' --stack名稱%STACK_NAME% --capabilities%CAPABILITIES% --template-URL%TEMPLATE_URL% - -region%global_region% --parameters%PARAMETERS% – Mike 2015-01-05 19:33:40

+0

聽起來不錯。如果答案對你有用,請考慮接受它... :) – huelbois 2015-01-05 19:55:10

3

您還可以配置它使用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