Skip to main content

AWS : Boto3 (Create, Delete RDS using Python)

Below code is to delete a existing RDS and also to create a new RDS in AWS RDS using boto3 python package :

import boto3

# Creating a client session for RDS using region name, aws_access_key_id & aws_secret_access_key
client = boto3.client('rds', region_name="ap-south-1",
aws_secret_access_key = 'YOUR_AWS_SECRET_ACCESS_KEY',
aws_access_key_id = 'YOUR_AWS_ACCESS_KEY_ID')

# Deletig an existing instance
# DB instance ID is enough, make sure to skip final snapshot & delete any automated backup's
response = client.delete_db_instance(
DBInstanceIdentifier='newpoc',
SkipFinalSnapshot=True,
DeleteAutomatedBackups=True
)

# To cross check if any RDS is available
response = client.describe_db_instances()
print(response)

# To create a new RDS in AWS
# DBInstanceIdentifier is the name of RDS
# Engine must be your expected RDBMS name
# Provide user name and password using MasterUsername & MasterUserPassword properties
response = client.create_db_instance(
DBName='mysqldbtestdb',
DBInstanceIdentifier='newpoc1',
AllocatedStorage=20,
DBInstanceClass='db.t4g.micro',
Engine='mysql',
MasterUsername='admin',
MasterUserPassword='Mypassword.1',
PubliclyAccessible=True
)


GitHub location to get above python code :

https://github.com/amathe1/boto3_project/blob/main/boto3_module/b3_RDS_create_delete.py


Have a great day!


Arun Mathe

Gmail ID : arunkumar.mathe@gmail.com





















Comments

Popular posts from this blog

(AI #1) Deep Learning and Neural Networks

I was curious to learn Artificial Intelligence and thinking what is the best place to start learning, and then realized that Deep Learning and Neural Networks is the heart of AI. Hence started diving into AI from this point. Starting from today, I will write continuous blogs on AI, especially Gen AI & Agentic AI. Incase if you are interested on above topics then please watch out this space. What is Artificial Intelligence, Machine Learning & Deep Learning ? AI can be described as the effort to automate intellectual tasks normally performed by Humans. Is this really possible ? For example, when we see an image with our eyes, we will identify it within a fraction of milliseconds. Isn't it ? For a computer, is it possible to do the same within same time limit ? That's the power we are talking about. To be honest, things seems to be far advanced than we actually thing about AI.  BTW, starting from this blog, it is not just a technical journal, we talk about internals here. ...

Spark Core : Understanding RDD & Partitions in Spark

Let us see how to create an RDD in Spark.   RDD (Resilient Distributed Dataset): We can create RDD in 2 ways. From Collections For small amount of data We can't use it for large amount of data From Datasets  For huge amount of data Text, CSV, JSON, PDF, image etc. When data is large we should go with Dataset approach     How to create an RDD ? Using collections val list = List(1, 2, 3, 4, 5, 6) val rdd = sc.parallelize(list) SC is Spark Context parallelize() method will convert input(collection in this case) into RDD Type of RDD will be based on the values assigned to collection, if we assign integers and RDD will be of type int Let's see below Scala code : # Created an RDD by providing a Collection(List) as input scala> val rdd = sc.parallelize(List(1, 2, 3, 4, 5)) rdd: org.apache.spark.rdd.RDD[Int] = ParallelCollectionRDD[0] at parallelize at <console>:23 # Printing RDD using collect() method scala> rdd.collect() res0: Array[Int] = Array(1, 2, 3, 4...

(AI #3) Deep Learning Foundations - Activation & Loss Functions, Gradient Descent algorithms & Optimization techniques

It is extremely important to have a deep knowledge while designing a machine learning model, otherwise we will end up creating ML models which are of no use. We have to have a clear understanding on certain techniques to confidently build a ML model, train it using "training data", finalize the model and to deploy it in production. So far, from blog #1, #2, we have seen about the fundamentals of Deep Learning and Neural Network, architecture of a Neural Network, internal layers and components etc.  Providing the links of Blogs #1 , #2 below for quick reference. Deep Learning & Neural Networks : https://arunsdatasphere.blogspot.com/2026/01/deep-learning-and-neural-networks.html Building a real world neural network: A practical usecase explained : https://arunsdatasphere.blogspot.com/2026/01/building-real-world-neural-network.html Now let's dive through below concepts/criteria to help gaining confidence on building your ML model: Activation Functions (Forward Propaga...