Skip to main content

Posts

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...

Manage ELB using Python Boto3

 Managing AWS ELB automations using Boto3 Python scripts.  What is ELB? ELB automatically distributes incoming network traffic (may be HTTP/HTTPS requests) across multiple EC2 instances running in different Availability Zones. ELB to EC2 instances  In this post I will experimenting on the following:  Create ELB  Apply security group Create Health check Register instances with ELB   Delete ELB services 1. How to Create ELB using Python Boto3 automations? The create_load_blancer method is used to create a Load Balancer. object: client refers to elb  method: create_load_blancer() which requires LoadBalancerName, Listeners that is again a dictionary of Protocol,LoadBalancerPort,InstanceProtocol, InstancePort, And another parameter 'AvailabilityZone' is important that refer to region on which you ar working on. import boto3 elb_client=boto3.client('elb') response = elb_client.create_load_blancer( LoadBalancerName='vybhava_lb', Listene...

AWS S3 Automation Using Python Boto3 – Create Buckets, Upload Files, Manage Objects, and Host Static Websites

Are you still uploading files to Amazon S3 manually through the AWS Console? As cloud environments continue to grow, manually managing buckets and objects becomes inefficient. Using Python and Boto3, we can automate S3 operations, improve productivity, and integrate storage management into DevOps workflows. In this article, we will explore the most common Amazon S3 operations using Python Boto3, including bucket creation, file uploads, object management, and static website hosting. What We'll Learn By the end of this article, you will be able to: Create Amazon S3 buckets using Python Upload files and objects to S3 Delete objects from buckets List bucket contents programmatically Retrieve all S3 buckets in your AWS account Understand S3 access control concepts Learn S3 automation best practices Prepare S3 buckets for static website hosting Build reusable cloud storage automation scripts Why Automate Amazon S3? Amazon S3 (Simple Storage Service) is one of the m...

Manage AWS EC2 Instances Using Python Boto3 – Complete Automation Guide

Hey Welcome! back to Automations with Python for AWS!!  Amazon Elastic Compute Cloud (EC2) is one of the most widely used AWS services for hosting applications and workloads in the cloud. While AWS Management Console provides a user-friendly interface, managing hundreds of EC2 instances manually becomes inefficient and error-prone. Python automation with Boto3 allows organizations to perform instance operations consistently, securely, and at scale. Boto3 is the official AWS SDK for Python that enables developers and DevOps engineers to interact with AWS services through code. It provides APIs for launching, monitoring, stopping, rebooting, and terminating EC2 instances. AWS EC2 instances managing with Python Boto3 SDK What are we doing? Have you ever logged into the AWS Console just to start, stop, or reboot EC2 instances and wondered if there was a faster way? As DevOps Engineers, Cloud Administrators, and Automation Architects, we perform repetitive EC2 management tasks every d...

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...

Python Interview Questions -Coding Snipets

 This post is dedicated for all DevOps Engineer, Software Engineers who are preparing for Coding Interviews,  Overview of Coding Interviews Most Companies looking for People with minimum Coding knowledge. In a coding interview, you will be given a small problem to solve within 10 - 20 minutes online screen or in-person on their system. In the question, you might be having some part of the code framed and you might be asked to write a snippet of code in between. You need to understand the code comments and proceed to build the expected snippet of code. Bigger companies look for the General purpose questions, where small companies look for specific questions. The General questions would be like this: Determine if the given word is a palindrome or not. (Example madam) Determine given number is prime or not. How to prepare for a coding interview? Now we have the flexibility to choose the programming language on which you are comfortable.  In general DevOps Infra guys will be ...

Operators in Python

Hello Pythonist, here in this post I wiould like to share you about the all Python operators how they can coperates on the literals and variables at different sinarios. Unlike any other Programming languages,  Python supports wide variety of operators. Logical operators Comparison operators Bitwise operators Let's explore more ... Logical Operators The Python Logical operators are simple English words  and  or  not All these above operators returns boolean values based on the combination of operands. Comparison operators There are several comparison operators as >, <, >=, <=, ==, !=  Also in operators Bitwise Operators Binary number 0 and 1 will be used as operands bitwise operators & | ^ and ~ allow us to manipulate single bits of data and they returns 0 or 1 based on the data bit values passed. Python Bit-wise Operators Bit shift operators Left bit-shift operator << Right bit-shift operator >>

Python Basics Literals and Variables

Literals Python Variables Python can do any athematic calculations but to bring it to a meaningful representation, reusability and easy referencing a value we use variable. Valid variable names A variable name can be combination of letters, numbers, and underscore. The variable name must start with either letter or underscore symbol. No other symbol or numbers allowed in the first character. Example variable names: server_name total_servers cpu_load_average server10_mem_size The Variable name defined in lower case is different that defined with upper case, they are created at different memory locations. cpu_load_average not same as CPU_load_average mem not same as MEM Invalid Variable definations We should not use any type of operator symbols in defining the variable. Here is some variables defined throws errors c@paci+y ~ not valid @ and + total_@f_server ~ using @ not valid 10thserver ~ initial number not allowed W...

Introduction to Python Orientation

Python Building Blocks Hello everyone, Python enthusiast let me start about how we began this blog, Started learning Python from Pavan we (Sujith, Purushotham) and started noting the class and then looking into several web stuff and also into Python e-books. Once we got summary thought of sharing the idea of what we had learned about each topic as one blog post. This can continue for the next students as well anyone can share this and comment on this post. this blog posts are specially intended for newly started Python  Programming.  Re-editing : 06-Mar-2022, As I've looked at PCEP Practice exam some of the basic info that I recollected updated here in this below section. Re-edited it on 21-03-3023  Little about Python History Python came from British comedy group "Monty Python" TV show. In Feb1991 Python first release version came. Python was designed and developed by Guido Van Rossum . The Python major implemented languages are:  CPython ,  PyPy ...

Installing Python on Windows Machine

Hey Guys! in this post we will be exploring the Installation procedure for Python 3 on Windows 10+ version Operating System. Do I need to check anything before installation of Python? Please check the version of Python is already installed using CMD window by typing 'python -V'. Please be aware of your Operating system version by checking 'This PC' properties.  How to install Python IDE on Windows System? Step1: Download Python from Official Python website  when you visit the website it automatically detects your Operating System and shows the download link. Here it will be Windows download! Step 2: Run the exe file which was downloaded [the file name could be like Python-3.x.x-amd64.exe  ] Navigate thru all the options you wish to choose select them. Please click on 'Install Now' option. Setup progress will show the green color progressbar it should completed by 100%; that's all   3:58 Installation of Python on Windows|Mac keep looking up to 10...

AWS DevOps Engineer Online Exam Question

SRE DevOps Engineer Exam Programming Language you can select any here I've selected as Python 3 Printing Last two digits  You are given array consists of n integers. Print the last two digits of its array values.  Given Inputs  The first line of input contains an integer n, representing the number of elements in the given array.  The second line of input contains n space separated integers, representing elements of the given array.  2 25 10  Expected Output  Print the last two digits of the product of array values.  Note that you always need to print two digits. Constraints  1<=n<=100 1<=ar[i] ar[i] is the element of the array  ### YOUR TASK ### def output(arr): ### Write you code logic here ### product_arr = 1 for i in arr: product_arr*=i print("Product of ar...

Installation of Python 3 in Linux

Beliefs As our belief, every Linux flavor has Python as one of the Shell. but that shell was created long back based on the OS release time repositories. In the most common situation where built-in Python might be at Python 2.7.x version but the latest version is on Python 3.7.x. The big challenge here is 'how do I upgrade or install Python3 on Linux?' So I've chased this challenge and completed the latest version installed on my Oracle Linux box. Python 3 installation on RHELflavors How do I install Python3 latest version on Linux? Python Programming is simple and kids can learn by doing! It's capabilities to interact with machine internals and the simple structure makes easy to write and understand it. The latest Python version for download you can find from the Python official site . Here I'm installing Python3 on the Oracle Linux same steps will be followed on any RHEL flavors as well. yum -y groupinstall development yum -y install zlib-devel Note: I...