Aws Cli New
Aws Cli New
2
CLI
Developing and performing AWS tasks against AWS can be done
in several ways.
3
CLI Installation
4
CLI Installation on Linux
Yum install –y python
python --version
▪ Yum install wget
▪ wget https://pypi.python.org/packages/source/s/setuptools/setuptools-7.0.tar.gz
▪ tar xvf setuptools-7.0.tar.gz
▪ cd setuptools-7.0
▪ python setup.py install
▪ wget https://bootstrap.pypa.io/get-pip.py
▪ python get-pip.py
▪ pip install awscli
▪ aws --version
▫ AWS will store these credentials and configuration details in two
separate files named ~/.aws/credentials and ~/.aws/config, 5
respectively
AWS CLI on EC2 .. The Bad
Way!!
▪ We could run ‘AWS Configure’ on EC2 just like we did (and all it works).
▪ But .. It’s SUPER INSECURE.
▪ NEVER NEVER EVER PUT YOUR PERSONAL CREDENTIALS ON EC2.
▪ Your PERSONAL credentials are PERSONAL and only belongs on your
PERSONAL computer.
▪ IF the EC2 is compromised, so is your personal account.
▪ If the EC2 is shared, other people may perform AWS actions while
impersonating you.
▪ For EC2, there is a better way… its called AWS IAM ROLES
6
AWS CLI on EC2 .. The RIGHT
Way!!
▪ IAM Roles can be attached to EC2 instances
▪ IAM Roles can come with a policy authorizing exactly what the EC2
instance should be able to do.
▪ This is the best practice on AWS, you should do it 100%
7
AWS EC2 Instance Metadata
▪ The URL curl http://169.254.169.254/latest/meta-data
▪ You can retrieve the IAM Role name from the meta-data, but you
CANNOT retrieve the IAM policy.
▪ Meta-data = Info about EC2 instance
▪ User-data = launch script of the EC2 instance.
8
Lab on CLI
▪ Install CLI on local Linux machine.