This repository contains samples and examples demonstrating cloud resource provisioning and usage for Amazon AWS and Google Cloud Platform (GCP).
-
Create virtual environment
$ python3 -m venv venv
$ source venv/bin/activate
-
Install requirements in the virtual environment
$ pip install -r requirements.txt
-
Setup PYTHONPATH
$ export PYTHONPATH=.:$PYTHONPATH
-
Do AWS setup as outlined below
Next, you will need to setup AWS CLI on your machine. You can do that using either the AWS setup or the Vagrant setup.
-
Sign up for AWS
-
Add AWS IAM user: Go to IAM (Search in search box on the top) -> Users -> Add User -> Select Access Key - Programmatic access for credential type
For permission boundary, select Create user without a permissions boundary. Then click next to create a user.
After user is created, add permission : Select user -> Add permissions -> Attach existing policies directly -> Search for "AmazonS3FullAccess"
-
Create Access Key for the User and download it as CSV to your machine.
-
Install AWS CLI and then set it up:
- https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html
- https://docs.aws.amazon.com/cli/latest/userguide/getting-started-quickstart.html#getting-started-quickstart-new-command
Use the
aws configure
command to configure the CLI.
You will be asked to enter aws_access_key_id, aws_secret_access_key, region, and output format. You can find names of AWS regions at the following link:
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html
A Vagrantfile is provided to help with the setup of a development environment with all the required tools. It defines a Ubuntu VM and the tools that will be installed on it. Following tools will be installed as part of VM creation: aws cli, docker, google cloud cli, helm, kubectl, minikube Follow the below steps to get your Vagrant VM running.
-
Install Vagrant:
-
Install VirtualBox:
-
vagrant box add bento/ubuntu-18.04
-
vagrant up
-
vagrant ssh
Once you login to the VM:
-
Check /vagrant directory. it will be the directory on your host machine where you have the Vagrantfile
- Any files that you want to copy from your host machine to the VM, place them in the directory where you have the Vagrantfile and access them from /vagrant path inside your VM.
- Any work that you do inside the /vagrant directory from inside the VM, it will be available from your host machine as well.
-
Check the tools have been installed properly.
- aws --version
- docker --version
- gcloud --version
- kubectl version
- minikube version
- helm version
-
VM:
-
Examples demonstrating provisioning and management of Cloud VMs
-
Try:
$ python VM/ec2_handler.py
-
-
libvirt:
-
Examples demonstrating managing guest OSes (domains) on a host using libvirt
-
Try on EC2 Ubuntu 16.04 t2.micro instance
$ sudo apt install python-pip $ pip install libvirt-python $ python libvirt/domain_handler.py
-
-
ObjectStores:
-
Examples demonstrating use of Cloud Object Stores (e.g. AWS S3)
-
Grant AmazonS3FullAccess permission to your IAM Service Account / User
-
Try:
$ python ObjectStores/s3_handler.py
-
-
DynamoDB:
- Starter code for working with AWS DynamoDB
- Grant AmazonDynamoDBFullAccess to your IAM Service Account / User