【问题标题】:Can one specify the default region for the EC2 command line tools using a variable?可以使用变量指定 EC2 命令行工具的默认区域吗?
【发布时间】:2013-10-22 12:03:06
【问题描述】:

是否有 EC2_* 环境变量来指定 EC2 命令行工具的默认区域以避免为每个命令指定 --region eu-west-1 选项?

【问题讨论】:

    标签: amazon-ec2 ec2-api-tools


    【解决方案1】:

    对于最新的 AWS CLI:

    export AWS_DEFAULT_REGION=eu-west-1
    

    参考:

    http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html

    对于较旧的 EC2 CLI:

    export EC2_URL=https://ec2.eu-west-1.amazonaws.com
    

    参考:

    http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/SettingUp_CommandLine.html

    http://docs.aws.amazon.com/general/latest/gr/rande.html

    【讨论】:

    • 是的,RTFM。感谢您提供指向最新版本 (AWS_DEFAULT_REGION) 的链接。正是我想要的!
    • 当然这会改变它任何东西,所以如果你只是暂时想要它,你应该尽快把它改回来并序列化访问。 AWS 人,某种 PUSH 和 POP 会很好。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-12-26
    • 2014-12-23
    • 1970-01-01
    • 2010-12-05
    • 1970-01-01
    • 1970-01-01
    • 2020-09-04
    相关资源
    最近更新 更多