Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/amitdhanani2012/boto_poc_aws_ec2_instance_vpc
his POC (Proof Of Concept) is created to demostrate how Python3 - boto3 can be used for AWS resource creation and destruction.
https://github.com/amitdhanani2012/boto_poc_aws_ec2_instance_vpc
Last synced: 26 days ago
JSON representation
his POC (Proof Of Concept) is created to demostrate how Python3 - boto3 can be used for AWS resource creation and destruction.
- Host: GitHub
- URL: https://github.com/amitdhanani2012/boto_poc_aws_ec2_instance_vpc
- Owner: amitdhanani2012
- Created: 2024-11-12T09:39:17.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2024-11-12T10:25:56.000Z (about 1 month ago)
- Last Synced: 2024-11-12T10:36:34.333Z (about 1 month ago)
- Language: Python
- Size: 0 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
This POC (Proof Of Concept) is created to demostrate how Python3 - boto3 can be used for AWS resource creation and destruction. Here Boto3 Python3 code is shown for "AWS VPC creation from scratch ,One public Subnet creation from scratch, Internet Gateway, Route Table creation from scratch, Routes in Route table creation from scratch, Security group with security rules (example ssh inbound access rule) creation from scratch,destruction of instance with perticular instance id and destruction of VPC with perticular vpcid". This is small code and there are many inhancement possible in this code. Its just showcase of my Boto3 Python3 and AWS service automation skills that shows that I can deliver more and I have adequate understanding/ability of AWS and Python3 Boto3 code.
Blog link https://amitdhanani.in/2024/11/12/how-to-use-python3-boto3-to-automate-aws-service-ec2-vpc-example/
#Code Usage
-----------1)create_instance(key,secrete,region,availablity_zone,ami_id1,instance_type1,ec2_instance_keyname1,boto_instance_profile1)
--------------------------------------------------------------------------------------------------------------------------
1.1)
create_instance will create vpc, subnet (public subnet creation via creating and attaching internet gateway to subnet via creating route table with route association with internet gateway), security group with rules to allow ssh traffic, 1 ec2 instance (can change min max in ec2_resouce1 to create more than one ec2 instance) with public ip having instance tag 'my-ec2-instance'. It will also display running instance with tag 'my-ec2-instance'. At completion of this funcion create_instance it
will display vpcid,instance id and other created resource ids.1.2)
here in create_instance - key is aws_key_id,secrete is aws_secrete_access, region is aws region with availability zone as availablity_zone, instance_type1 is instance type, instance_keyname1 (must pre-exist, we can create using boto library before instance creation) is ssh key to assoiciate with ec2 instance, ami_id1 is ami image id, boto_instance_profile1 is instance profile to associate with instance2)destroy_instance(instanceid,region,key,secrete)
-------------------------------------------------
2.1)
It will destroy perticular instance having instance id as instanceid in region region having key is aws_key_id and secrete is aws_secrete_access2.2)
it will display response of instance destruction3)destroy_vpc(vpcid,region,key,secrete)
----------------------------------------
3.1)
it will destroy perticular vpc having vpcid as vpcid in region region havig key is aws_key_id and secrete is aws_secrete_access3.2)
it will display response of vpcid destruction