[python]Trying out AWS SDK

I got myself a free basic account to do some hands on try outs. It is not necessary to use the AWS SDK to invoke the API. This try out is to write a simple static script to create a new VPC and subnet from this new vpc.
The SDK is known as boto3, you can use pip to download the sdk. For this script to run I created an api account with the below three permissions:
Screenshot 2018-10-19 at 10.08.50 PM.png
Here’s the code:

import boto3

# For a list of region names refer https://docs.aws.amazon.com/general/latest/gr/rande.html
    aws_access_key_id='key is obfuscated',
    aws_secret_access_key='key is obfuscated',

ec2 = boto3.resource('ec2')
    vpc = ec2.create_vpc(CidrBlock='')
except BaseException as e:

Here’s the result:
Screenshot 2018-10-19 at 10.12.53 PM
Screenshot 2018-10-19 at 10.13.46 PM


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s