Skip to main content

Posts

Showing posts with the label aws

AWS Auto Scaling using Python Boto3

Auto Scaling Group in AWS configure using Python Boto3  What is Auto Scaling means?  This is key capability or power of Cloud Computing Engineers believe in their skills on scaling abilities.  Amazon EC2 Auto Scaling helps to maintain application availability and lets automatically add or remove EC2 instances using scaling policies that we define.  There are 2 types of scaling policies : Dynamic or predictive. These scaling policies let us add or remove EC2 instances capacity to service established or real-time demand patterns. It contains various steps involved in Auto Scaling process using Python Boto3 we will explore every step that accumulate to form a complete automation solution for a DevOps project. ASG Groups associated with ELB and EC2 instances   Understanding AWS Auto scaling configuration steps Check any running instances Create launch configuration Configure ASG for Auto scaling Verify the configuration Disable Auto Scaling In order to setup A...

AWS Manage S3 Buckets using Python Boto3

 In this post, I will show you  how to create S3 bucket,  how to put objects into the bucket,  how to upload multiple objects in s3,  how to download multiple objects,  how to control access policy, and  how to host a static website in S3.  1. How to create S3 Bucket using Python3 Boto3? Object : resource method: create_bucket  important method  parameters:   ACL : private or public   Bucket - name of the bucket name this should be unique for each bucket   CreateBucketConfiguration - have the LocationConstrating that is region on which you want to host your s3 bucket. import boto3 s3_resource = boto3.resource('s3') bucket = s3_resource.create_bucket(ACL='private', Bucket='vybhava2023demo.com', CreateBucketConfiguration={ 'LocationConstrating': 'us-west-2' }) print("Successfully create bucket:", bucket) 2. How to put the objects into the S3 Bucket using Boto3 When you want to add fil...

Manage AWS EC2 Instances using Python Boto3 script

Hey Welcome! back to Automations with Python for AWS!!  Now IT market says AWS is the top number one Cloud Computing platform. That is why I've selected this AWS automations using Python Boto3. In this post we will be exploring the AWS EC2 Instance related operations, and manage them in a reusable form. Create EC2 instance using Python Boto3 Launch AWS EC2 instance using Python Boto3 script Stop AWS EC2 instance using Python Boto3 script Start AWS EC2 Instance using Python Boto3 script Terminate AWS EC2 instance using Python Boto3 script Fetching Public IP of given instance-id How do you Create EC2 instance using Python3 Boto3?   Creating EC2 instance using Boto3 Python code #============================================= # File : create_ec2.py # Description: Create EC2 instance by Boto3 import boto3 ec2 = boto3.resource('ec2') instances = ec2.create_instances( ImageId="ami-0dafa01c8100180f8", MinCount=1, MaxCount=1, Inst...

Python Automations using Boto3 for AWS

The objective of this post is for experimenting with AWS Boto3 automations and AWS Lambda, most of the realtime usecase on AWS cloud controlled and acceleration with them. We should know as SRE or DevOps Engineer how to refer to the Boto3 documentation where AWS team provided lot of details and examples of each Boto3 method, I'm pretty sure you could make great automations with this Boto3 module explore ideas. Python for AWS Using Boto3 Let's jump on it... Prerequisites You must have AWS account [this can be your company provided or free-tire account]. Getting Started Python Automations using Boto3  Step 1: Add User in IAM  Let's get into the IAM adding user you can provide username as devops-admin Select AWS Access TYPE {tic} programmatic access this allows to access key ID and secret access key for the AWS API, CLI SDK (Boto3 uses this). Set permissions for 'devopsuser' Select policy type as 'AdministrationAccess' to access AWS resources and services [For...