[PYTHON] Install aws-cli on MacPorts

It was officially released before I knew it, so I will summarize it

Premise

Installation

Check installed Python
$ sudo port installed | grep py
  git-core @1.8.4_0+credential_osxkeychain+doc+pcre+python27 (active)
  python27 @2.7.5_1 (active)
・ ・ ・
Install pip corresponding to python version with macports (enter because setuptools also depends)
$ sudo port install py27-pip
Install the pip module from your package management system
$ sudo easy_install pip
install aws-cli
$ sudo pip install awscli 

Setting

Enable autocomplete for subcommands
 $ complete -C aws_completer aws
Check aws settings
  1. Open the AWS Management Console
  2. Check the Access Key ID and Secret Access Key with Security Credentials, etc.
  3. Check the region name from Availability Zone Status of EC2 Dashboard (example: value with the end of ap-northeast-1a, ap-northeast-1 is the region name)
Do either method
For Environment variables
$ export AWS_ACCESS_KEY_ID=<access_key>
$ export AWS_SECRET_ACCESS_KEY=<secret_key>
For Config file

With this method, you can write for each environment by specifying porfile.

[default]
aws_access_key_id=<default access key>
aws_secret_access_key=<default secret key>
# Optional, to define default region for this profile.
region=<Region name>

[profile testing]
aws_access_key_id=<testing access key>
aws_secret_access_key=<testing secret key>
region=<Region name>
$ export AWS_CONFIG_FILE=/path/to/config_file
For IAM Role

If you install and use aws-cli on your EC2 instance, and you are using IAM, it seems that it will automatically use your Access Key ID and Secret Access Key.

Try it out

Environment variables, IAM Role
$ aws ec2 describe-instance-status --region <Region name>
For Config file
$ aws ec2 describe-instance-status --profile=testing

Official site

https://github.com/aws/aws-cli

Recommended Posts

Install aws-cli on MacPorts
Install awscli on centos7
Install mecab on Marvericks
Install Tensorflow on Mac
Install TensorFlow on Ubuntu
Install python on WSL
Install Faiss on CentOS 7
Install pyenv on mac
Install pip on Mavericks
Install Python on Pidora.
Install mongodb on termux
Install Scrapy on python3
Install docker on Fedora31
Install numba on CentOS 7.2
Install Python on Mac
Install Python 3 on Mac
Install Plone (4.3.6) on MacOSX (10.10.3)
Install Python3.4 on CentOS 6.6
Install JModelica on Ubuntu
Install Anaconda on Windows 10
How to install OpenGM on OSX with macports
Install numpy on Marvericks
Install python on windows
Install enebular-agent on Chromebook
Install pycuda on Windows10
Install mecab-python on CentOS
Install Python 2.7.3 on CentOS 5.4
Install pygraphviz on Windows 10
Install Docker on AWS
Install Python 3.3 on Ubuntu 12.04
Install Chainer 1.5.0 on Windows
Install Python 3.4 on Mac
Install Caffe on Mac
Install Theano on Ubuntu 12.04
Install pyenv on OSX
Install mecab on mac
Install angr on Ubuntu 18.04
Install Chainer on CentOS 6.7
Install mecab-python on Mac
Install pip / pip3 on Ubuntu
Install Python 3.6 on Docker
How to install caffe on OS X with macports
Install octave_kernel on Jupyter [additional]
Install Numpy on virtualenv on Windows
Install Minecraft on Arch Linux
Install cvxopt on 64bit Anaconda
Install Scrapy on Raspbian (Jessie)
Install Python 3.8 on RHEL 8 (AppStream)
Install Linux on your Chromebox
Install pygame on python3.4 on mac
Install tomcat 9 on Cent OS 8
Install cvxpy on windows, Anaconda
Install ImageMagick-6.2.x series on CentOS7.7
Install Python 3.8 on CentOS 7 (SCL)
Install the JDK on Linux
Install module on Anaconda (Mac)
Install OpenPose on mac (Catalina)
Install MariaDB on Sakura's VPS
Install numba on your Mac
Install pandas 0.14 on python3.4 [on Mac]
Install OpenCV on Ubuntu + python