Boto3 is python3 library for AWS cloud deployment automation. Its Infrastructure as code.
I have created one POC (Proof Of Concept) to demostrate how we can automate AWS EC2 and AWS VPC creation/destruction using Python3 boto3 library.
This code is realtime and ready made to use now. I shown example of VPC creation/destruction having one public subnet and EC2 instance having one instance.
It can be enhanced as per requirements like adding autoscaling – multiple az – load balancer – public/private subnets, AWS Network Firewall,WAF, API Gateway, RDS/Database, etc.
We can also use boto3 function to create EKS cluster using boto client boto3.client(‘eks’) and its functions like create_cluster, create_nodegroup,etc
Here I created code to ” create one VPC, create one subnet, create Internet gateway and its association/attachment with VPC, creation of route table/routes to internet gateway, creation of route table association with subnet to have public access via internet gateway, creation of security group with creation of security group rules for inbound ssh traffic from internet to instance,creation of ec2 instance with public ip and destruction of EC2 instance/VPC “.
Link of Code is at https://github.com/amitdhanani2012/boto_poc_aws_ec2_instance_vpc
Reference Link :
1.
https://boto3.amazonaws.com/v1/documentation/api/latest/index.html
2.
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/eks.html
Leave a comment