Keeping awsr in sync with new AWS CLI v2 releases through a daily GitHub Actions workflow
awsr, the Rust CLI from my previous post, returns output byte for byte identical to the AWS CLI v2, so to keep returning the same output, awsr has to move to each new AWS CLI version as it comes out.
The AWS CLI released 20 times in the 36 days from 2026-09-30 to 2026-11-05, with a new version almost every weekday, so I set up GitHub Actions to run this update every day.
For each new version, the workflow makes the change that bumps the version, compares awsr with the AWS CLI, and opens a PR with the results.
The image below shows the PR that the workflow created when 2.39.5 came out, with a table of the comparison results before I ported anything.
What changes when you bump the version
awsr follows one fixed AWS CLI version.
I write that version number in models/VERSION, and flake.nix pulls in the AWS CLI source and the official Linux installer of the same version with Nix.
Bumping the AWS CLI version therefore changes three things:
- botocore models: the service and operation definitions that
awsrembeds in its binary. - Expected test values: the command table, the hashes of the argument tables, the help documents, and the waiter descriptions, which I generate from the AWS CLI models and source.
- AWS CLI code changes: changes to commands with their own logic and to authentication. In the AWS CLI changelog, these are the entries other than
api-change, such asenhancementandbugfix.
A script can regenerate the models and expected values from the AWS CLI, but I have to port code changes to Rust.
The version bump script
scripts/update-reference.sh regenerates the models and expected values.
$ scripts/update-reference.sh 2.39.5
The script runs these steps in order:
- Fetch the hashes of the AWS CLI source and installer with
nix-prefetch-url, and update the version and hashes inflake.nix. - Enter the devShell of the new version, re-import the models with
scripts/vendor-models.sh, and set the three data crates that hold the models to the AWS CLI version. - Regenerate the command table, the hashes of the argument tables, the help documents, and the waiter descriptions from the AWS CLI source.
- Format the code with
nix fmt.
Before I relied on the scripts that generate the expected values, I ran them on the 2.39.3 source from before the update and checked that they reproduced the committed expected values.
The daily workflow
The Reference workflow looks up the latest AWS CLI tag every day at 12:00 UTC.
If it finds a version newer than models/VERSION, it bumps the version with the script above and runs these four checks:
make check: runs fmt, clippy, and the tests.- Differential tests: run every operation of the services whose models changed in both
awsrand the AWS CLI, and compare the output and the requests. - Help comparison: on the help pages of the services whose models changed, replace the name
awsrwithawsand compare byte for byte. On pages where the longer name moved the line wrapping, compare with the wrapping removed. - Scenario and authentication comparison: compare hand-written scenarios, scenarios for the
s3commands, and authentication commands such asconfigureandsso login.
After the checks, the workflow pushes the reference/<version> branch and opens a PR with the results table.
The PR body also lists the AWS CLI changelog entries other than api-change.
If any check fails, or if scripts/classify-reference-changes.sh finds files to port in the diff of the AWS CLI source, the workflow marks the PR as a draft.
If nothing needs porting and all checks pass, the workflow merges the PR and starts the Release workflow as well.
Comparing only the services that changed
A differential test run over all services compares more than 230,000 combinations against the AWS CLI, and without a cache of AWS CLI results it took about 100 minutes on my 14-core PC.
The ubuntu-latest runner that GitHub Actions gives public repositories has 4 cores, so I can't run the full set every day.
The daily comparison covers only the services whose models changed. From 2.39.3 to 2.39.5, the models of 34 services changed, and their operations came to 48,504 combinations.
The run that bumped awsr to 2.39.5 took about 71 minutes in total: about 44 minutes for the differential tests including the release build, and about 18 minutes for comparing 4,189 help pages.
What I ported in 2.39.5
The PR from 2.39.3 to 2.39.5 is conao3/rust-awscli#6, and the changelog of 2.39.4 and 2.39.5 had nine entries other than api-change.
I ported these four of them to awsr:
- Stop sending Bearer authentication tokens to endpoints other than HTTPS.
- Accept
--tagsons3 cp,s3 mv, ands3 syncfor transfers from local files to S3. - Count a transfer that fails with
PreconditionFailedas a skipped existing file only if the transfer has--no-overwrite. - Set the permissions of the config file that
deploy installwrites to 600.
The AWS CLI s3 commands have two transfer implementations, classic in Python and crt on the AWS Common Runtime (CRT), and you pick one with the preferred_transfer_client setting.
The other five entries cover the CRT transfer client and aws update on Windows.
awsr implements only the classic transfer client and has no update command yet, so those five need no porting.
The differential tests for account-access-runtime, a service added in 2.39.5, caught the Bearer authentication change.
24 cases for this service didn't match: the AWS CLI stopped with Bearer authorization requires an HTTPS endpoint., while awsr sent the request.
If I merged this change into master first, a different service that uses Bearer authentication would stop matching the 2.39.3 AWS CLI, so I port changes that depend on the AWS CLI version inside the version bump PR. I merged master into the PR branch, added the porting commits on top, and merged the PR after all comparisons passed on my machine.
The existing scenarios can't compare --tags, so I added six s3 scenarios.
If I take out the tagging code in awsr for a moment, the four upload scenarios among the six fail, so the scenarios do compare the tags.
A difference that showed up only on the runner
In the run that created the 2.39.5 PR, three deploy install and deploy uninstall scenarios failed, while the same scenarios matched on my PC.
deploy install refuses to run on EC2 instances, and it asks the metadata service at 169.254.169.254 to find out whether it runs on EC2.
GitHub Actions runners run on Azure or AWS, and the Azure metadata service uses the same address, but it rejects requests without the Metadata: true header.
The AWS CLI sends an HTTP GET with Python's urlopen and concludes it isn't on EC2 when it gets an error response.
awsr only checked whether a TCP connection succeeded, so on a runner where something answered at this address, it concluded it was on EC2.
I changed awsr to send an HTTP GET too and to treat the host as EC2 only when the response status is below 400.
To test this on my machine, I started a server that returns 400 or 200 at 169.254.169.254 inside a user namespace made with unshare -rnm, and replaced /etc/lsb-release with Ubuntu's.
With either status, the AWS CLI and awsr print the same output.
