Search code examples
amazon-ec2ec2-api-tools

Can one specify the default region for the EC2 command line tools using a variable?


Is there an EC2_* environment variable to specify the default region of the EC2 command line tools in order to avoid specifying the --region eu-west-1 option for each command?


Solution

  • for Latest AWS CLI:

    export AWS_DEFAULT_REGION=eu-west-1
    

    reference:

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

    for older EC2 CLI:

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

    reference:

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

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