amazon web services - How to index aws snapshot output? -
here printing snapshots. posted below snapshot print out like, , able print individual snapshots. not sure how great.
svc := ec2.new(&aws.config{region: "us-east-1"}) params := &ec2.describesnapshotsinput{ ownerids: []*string{ aws.string("130300684064"), }, } b, err2 := svc.describesnapshots(params) if err2 != nil { panic(err2) } fmt.printf(awsutil.stringvalue(b))
here gets outputted: http://imgur.com/3mnbnxi output:
{ snapshots: ----0 description: "snapshot multi", encrypted: false, ownerid: "130300684064", progress: "100%!"(missing), snapshotid: "snap-81b1dff6", starttime: 2015-07-21 18:41:54 +0000 utc, state: "completed", volumeid: "vol-5121ebaa", volumesize: 1 },{ ----1 description: "snapshot multi", encrypted: false, ownerid: "130300684064", progress: "100%!"(missing), snapshotid: "snap-08352a7f", starttime: 2015-07-21 18:41:54 +0000 utc, state: "completed", volumeid: "vol-9b21eb60", volumesize: 1 },{ ----2 description: "snapshot multi", encrypted: false, ownerid: "130300684064", progress: "100%!"(missing), snapshotid: "snap-768ffb00", starttime: 2015-07-21 18:41:54 +0000 utc, state: "completed", volumeid: "vol-5620eaad", volumesize: 1 }]
full code here: http://pastebin.com/qgmv6krj
if want print details of individual snapshots, can iterate on response:
resp, err := svc.describesnapshots(params) if err != nil { log.fatal(err) } i, s := range resp.snapshots { fmt.printf("snapshot: %d\n", i) fmt.println(s) }
Very useful blog... Thanks for sharing details about how to index AWS snapshot output. It is better to have AWS daily snapshot.
ReplyDelete