Hello Everyone Today we will learn about how to create AWS EBS Volume snapshot using boto3 Python version.
Firstly before creating using Python script , we will create on AWS that will be based on User Interface with Manual steps.
What is AWS EBS snapshot
It provides with the data protection for the long term as well as with the durability
that are in EBS Volumes that can also be used across various regions.
Each time it stores the unique the data which is modified after the last taken EBS snapshot.
Steps
One
First create the two EC2 instance on AWS with the different zones, choose the default configuration to create the instances with the Free tier options.
Two
After created the instances, generate the custom volume
Fill up the details , provided with the already created in zone like [us-east-2b] to be add
in the custom volume.
Three
Now, Attach to the new volume in it.
Device name can be vary,
Four
Need to mount the Volume .
Now we will use the python script to create it using Boto3
Example to create the script,
import boto3
AWS_REGION = "us-west-2c"
EC2_RESOURCE = boto3.resource('ec2', region_name=AWS_REGION)
VOLUME_ID = 'vol-011d7b0e740c4f587'
snapshot = EC2_RESOURCE.create_snapshot(
VolumeId=VOLUME_ID,
TagSpecifications=[
{
'ResourceType': 'snapshot',
'Tags': [
{
'Key': 'Name',
'Value': 'hands-on-cloud-ebs-snapshot'
},
]
},
]
)
Conclusion
Hope you got to know about the Boto3 using the python script. There are many other services
provided by Boto3 like instance creation and managing the IAM users and bucket lists in the
cloud for AWS and even filters the easily For more tech blogs follow the below
links. At knoldus we provide with upcoming technology and informative blogs for the
tech enthusiastic.
Follow my profile to know more about the DevOps and the technology which have been adopted in it.