0 votes
1 view
in AWS by (19.2k points)

The IAM user can be referred to in policy documents by ${aws:username}.

If I call describeSnapshots() of AmazonEC2 Java interface I get a big number of snapshots as described in the documentation because it includes all visible snapshots.

However to get the list of my snapshots, should be easy with the API, but it isn't obvious to me. I tried to pass a DescribeSnapshotsRequests object to describeSnapshots()

DescribeSnapshotsRequest req = new DescribeSnapShotRequests();

List<String> ownerId = new ArrayList<String>();



DescribeSnapshotsResult res = ec2.describeSnapshots(req);

However, to get my user id, I printed the user id of all snapshots and manually identified mine, copied that user id, and used in the source code.

I hope there is a better way to list my snapshots, anyone knows?

1 Answer

0 votes
by (44.6k points)

Try this


This works for me to describe images.

Welcome to Intellipaat Community. Get your technical queries answered by top developers !