Amazon EC2 CLI Installation: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
No edit summary
 
(6 intermediate revisions by the same user not shown)
Line 38: Line 38:
</pre>
</pre>


==Set the Access Keys==
==<span id='Set_the_Access_Keys'>Set AWS Credentials==


Provision the API access keys for the Amazon IAM user that will use the API. More details about access keys here: [[Amazon AWS Security#API_Access_Keys|Amazon AWS Security API Access Keys]].
{{Internal|Setting AWS Credentials|Setting AWS Credentials}}
 
Access keys can be specified on command line every time an ec2 command is issued, with:
 
<pre>
-aws-access-key or -O
--aws-secret-key or -W
</pre>
 
or by setting the following environment variables:
 
<pre>
export AWS_ACCESS_KEY=your-aws-access-key-id
export AWS_SECRET_KEY=your-aws-secret-key
</pre>


=Test Installation=
=Test Installation=
Line 64: Line 50:
=Set the Region=
=Set the Region=


<pre>
{{Internal|AWS_Region_Operations#Setting_Region_for_EC2_CLI|Set AWS Region}}
export EC2_URL=https://<service_endpoint> 
</pre>
 
Example:
 
<pre>
export EC2_URL=https://ec2.us-west-2.amazonaws.com
</pre>
 
Note: For some reason, the console always shows by default "Oregon", which corresponds to <tt>https://ec2.us-west-2.amazonaws.com</tt>.

Latest revision as of 23:11, 9 April 2019

External

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 AWS Credentials

Setting AWS Credentials

Test Installation

ec2-describe-regions

Set the Region

Set AWS Region