Wednesday, June 30, 2021

How To get Aws DB Snapshots list from aws cli and scripting

 #!/bin/bash

aws  rds --output text describe-db-snapshots --db-instance-identifier databaseName --query 'DBSnapshots[*].[DBInstanceIdentifier, AllocatedStorage, AvailabilityZone, SnapshotType, InstanceCreateTime, VpcId]' >  databaseName.csv

# single comand for snapshots
aws ec2 describe-snapshots --output text --query 'Snapshots[*]
 [Description,Encrypted,OwnerId,Progress,SnapshotId,StartTime,State,VolumeId,VolumeSize,OwnerAlias]' >  b.txt


# snapshots get by snapshot-type (manual)
 aws  rds --output text describe-db-snapshots --snapshot-type manual  --db-instance-identifier database-1 --query 'DBSnapshots[*].[DBInstanceIdentifier, AllocatedStorage, AvailabilityZone, SnapshotType, InstanceCreateTime, VpcId]' > a2.csv

#aws  rds --output text describe-db-snapshots --query 'DBSnapshots[*].[DBInstanceIdentifier, AvailabilityZone, SnapshotType, InstanceCreateTime, VpcId]' > a.csv

#aws  rds --output text describe-db-snapshots --snapshot-type manual  --db-instance-identifier database-1 --query 'DBSnapshots[*].[DBInstanceIdentifier, AllocatedStorage, AvailabilityZone, SnapshotType, InstanceCreateTime, VpcId]' > a2.csv

# aws  rds describe-db-snapshots --db-instance-identifier database-1--snapshot-type manual | jq '[.DBSnapshots[] | {Snapshot_Identifier:.DBSnapshotIdentifier,Creationtime:.SnapshotCreateTime}]'

No comments:

Post a Comment

How to give privilege for access of single aws bucket ..

 {     "Version": "2012-10-17",     "Statement": [         {             "Effect": "Allow"...