An Introduction to AWS Networking — Virtual Private Cloud

#!/usr/bin/env python3  
import json, boto3
region = 'us-east-1' vpc_name = 'mastering_python_networking_demo' ec2 = boto3.resource('ec2', region_name=region) client = boto3.client('ec2') filters = [{'Name':'tag:Name', 'Values':[vpc_name]}] vpcs = list(ec2.vpcs.filter(Filters=filters)) for vpc in vpcs: response = client.describe_vpcs( VpcIds=[,] ) print(json.dumps(response, sort_keys=True, indent=4))
(venv) $ python {     "ResponseMetadata": {         <skip>         "HTTPStatusCode": 200,         "RequestId": "9416b03f-<skip> ",         "RetryAttempts": 0     },     "Vpcs": [         {             "CidrBlock": "",             "CidrBlockAssociationSet": [                 {                     "AssociationId": "vpc-cidr-assoc-<skip>",                     "CidrBlock": "",                     "CidrBlockState": {                         "State": "associated"                     }                 }             ],             "DhcpOptionsId": "dopt-<skip>",             "InstanceTenancy": "default",             "IsDefault": false,             "OwnerId": "<skip>",             "State": "available",             "Tags": [                 {                     "Key": "Name",                     "Value": "mastering_python_networking_demo"                 }             ],             "VpcId": "vpc-<skip>"         }     ] }



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
ODSC - Open Data Science

ODSC - Open Data Science


Our passion is bringing thousands of the best and brightest data scientists together under one roof for an incredible learning and networking experience.