Installing Python Boto3 for AWS on MacOS

Boto3 is a Python library to interact with AWS APIs via command line. It works by leveraging AWS APIs in the backend and provides an easy interface to perform AWS actions like "Launch that shit" or "Trigger a lambda function to automate that shit". Installation on MacOS is as simple as following these steps.

Install Python

Install PIP (Python package manager)
$ python3 get-pip.py --user

Install AWS CLI
$ pip install --user --upgrade awscli 

Update path (Or, add following to your .bash_profile using $ sudo nano ~./bash_profile)
$ export PATH=~/Library/Python/2.7/bin/:$PATH 

Check if AWS CLI is installed correctly,
$ aws --version

Update AWS config file with access keys,
$ aws configure
AWS Access Key ID:
AWS Secret Access Key ID:
Default region name:
Default output format:

Install boto3
 $ sudo pip install boto3

Test boto3. Create a test file "fetchBuckets.py" from following code and run it with $ Python fetchBuckets.py.

import boto3
s3 = boto3.resource('s3')
for bucket in s3.buckets.all():
    print(bucket.name)

Popular posts from this blog

Installing CloudCustodian for AWS