Last active
May 15, 2020 10:48
-
-
Save RajputVaibhav/346251592922fefd5a855aebef6c7342 to your computer and use it in GitHub Desktop.
Python program syntax for using EBS APIs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
import json | |
client = boto3.client("ebs") | |
def get_snapshot_block(): | |
response = client.get_snapshot_block( | |
SnapshotId='', | |
BlockIndex=0, | |
BlockToken='' | |
) | |
print(response['BlockData'].read()) | |
#------------------------------------------------ | |
def list_snapshot_blocks(): | |
response = client.list_snapshot_blocks( | |
SnapshotId='' | |
) | |
for item in response['Blocks']: | |
for key,value in item.items(): | |
print('{} : {}'.format(key,value)) | |
print('\n') | |
#------------------------------------------------ | |
def list_changed_blocks(): | |
response = client.list_changed_blocks( | |
FirstSnapshotId='', | |
SecondSnapshotId='' | |
) | |
for item in response['ChangedBlocks']: | |
if('FirstBlockToken' in item.keys()): | |
for key,value in item.items(): | |
print('{} : {}'.format(key,value)) | |
print('\n') | |
# get_snapshot_block() | |
# list_snapshot_blocks() | |
# list_changed_blocks() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment