Amazon EC2 CLI Installation: Difference between revisions
No edit summary |
|||
Line 51: | Line 51: | ||
or by setting the following environment variables: | or by setting the following environment variables: | ||
export AWS_ACCESS_KEY=your-aws-access-key-id | |||
export AWS_ACCESS_KEY=your-aws-access-key-id | export AWS_SECRET_KEY=your-aws-secret-key | ||
export AWS_SECRET_KEY=your-aws-secret-key | |||
In case the Java process that is performing the call does not have access to the environment, the credentials may be specified in .aws/credentials: | |||
[default] | |||
aws_access_key_id=... | |||
aws_secret_access_key=... | |||
For more methods of configuring credentials see: | |||
{{External|}} | |||
=Test Installation= | =Test Installation= |
Revision as of 23:13, 1 October 2018
External
- Setting Up the Amazon EC2 Command Line Interface Tools on Linux/Unix and Mac OS X http://docs.aws.amazon.com/AWSEC2/latest/CommandLineReference/set-up-ec2-cli-linux.html
Internal
Download
wget http://s3.amazonaws.com/ec2-downloads/ec2-api-tools.zip
Unzip
cd /opt unzip .../ec2-api-tools.zip ln -s ./ec2-api-tools-1.7.5.1 ec2-api-tools
Adjust the command to reflect the actual EC2 API tools version.
Post-Install
Set JAVA_HOME
Set JAVA_HOME for all accounts that are going to use ec2 tools.
Set Environment
For all users that are going to use it, configure the following environment variables in their .bashrc (or equivalent):
export EC2_HOME=/opt/ec2-api-tools export PATH=${PATH}:${EC2_HOME}/bin
Set the Access Keys
Provision the API access keys for the Amazon IAM user that will use the API. More details about access keys here: Amazon AWS API Access Keys.
Access keys can be specified on command line every time an ec2 command is issued, with:
-aws-access-key or -O --aws-secret-key or -W
or by setting the following environment variables:
export AWS_ACCESS_KEY=your-aws-access-key-id export AWS_SECRET_KEY=your-aws-secret-key
In case the Java process that is performing the call does not have access to the environment, the credentials may be specified in .aws/credentials:
[default] aws_access_key_id=... aws_secret_access_key=...
For more methods of configuring credentials see:
Test Installation
ec2-describe-regions
Set the Region
export EC2_URL=https://<service_endpoint>
Example:
export EC2_URL=https://ec2.us-west-2.amazonaws.com
Note: For some reason, the console always shows by default "Oregon", which corresponds to https://ec2.us-west-2.amazonaws.com.