Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Result pagination #2

Open
rkistner opened this issue May 28, 2021 · 2 comments
Open

Result pagination #2

rkistner opened this issue May 28, 2021 · 2 comments

Comments

@rkistner
Copy link

rkistner commented May 28, 2021

The current script only lists the first 10000 changed pages for each snapshot, so gives inaccurate results for any volume larger than around 5GB.

I changed the relevant part to this to use pagination:

        changed = 0
        token = None
        while True:
            if token:
                page = ebs.list_changed_blocks(FirstSnapshotId = sid_prev,SecondSnapshotId = sid, NextToken=token, MaxResults=10000)
            else:
                page = ebs.list_changed_blocks(FirstSnapshotId = sid_prev,SecondSnapshotId = sid, MaxResults=10000)
            
            changed += len(page['ChangedBlocks'])
            if 'NextToken' not in page:
                break
            token = page['NextToken']
            if token is None:
                break
        print(date + ',' + time + ',' + v + "," + sid_prev + "," + sid + "," + str(changed * blockSize))

There is probably a similar issue in listing the snapshots, but it's less likely to run into the limit there.

@GauravES
Copy link

GauravES commented Oct 1, 2022

The current script only lists the first 10000 changed pages for each snapshot, so gives inaccurate results for any volume larger than around 5GB.

I presume you meant 10000 changed blocks and inaccurate results for any snapshot with changes exceeding ~5GB from the last snapshot.

Were you able to finally reconcile your script generated numbers with AWS billing?

@rkistner
Copy link
Author

rkistner commented Apr 6, 2023

I presume you meant 10000 changed blocks and inaccurate results for any snapshot with changes exceeding ~5GB from the last snapshot.

Yes, likely that. I think I just went with the simple "works for volume < 5GB".

I only used this to get estimates when using a new snapshot schedule. I never properly checked whether it matches the billing numbers, but it was close enough for my estimates.

Hummdis added a commit to Hummdis/AWS-Snapshots that referenced this issue Nov 28, 2023
Corrections for Python 3.9 and based on Issue akirsman#2 at akirsman#2.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants