Skip to content

Add S3 remote storage for snapshot save, load, and list - #344

Merged
anisaoshafi merged 7 commits into
mainfrom
devx-926-add-s3-only-support-for-snapshot-remotes
Jun 30, 2026
Merged

Add S3 remote storage for snapshot save, load, and list#344
anisaoshafi merged 7 commits into
mainfrom
devx-926-add-s3-only-support-for-snapshot-remotes

Conversation

@anisaoshafi

@anisaoshafi anisaoshafi commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

What

Adds support for saving, loading, and listing snapshots in your own AWS S3 bucket. Before this, a snapshot could only go to a local file or a LocalStack platform pod (pod:).

How

Set your AWS credentials or AWS_PROFILE, then use an s3:// path:

export AWS_ACCESS_KEY_ID=...
export AWS_SECRET_ACCESS_KEY=...
# or interchangeable with export AWS_PROFILE=...

lstk snapshot save my-pod s3://my-bucket/prefix    # save to S3
lstk snapshot load my-pod s3://my-bucket/prefix    # load it back
lstk snapshot list s3://my-bucket/prefix           # list what's in the bucket

Or use a named AWS profile instead of env vars:

lstk snapshot save my-pod s3://my-bucket/prefix --profile myprofile
lstk snapshot load my-pod s3://my-bucket/prefix --profile myprofile
lstk snapshot list s3://my-bucket/prefix --profile myprofile
  • The pod name (my-pod) is the snapshot's name in the bucket. Required for load; auto-generated for save if you leave it out.
  • Credentials come from AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY (and optional AWS_SESSION_TOKEN), from --profile, or from the profile named by AWS_PROFILE.
  • Credentials can't be put in the URL.

Under the hood

  • lstk doesn't talk to S3 itself. It passes your credentials to the emulator, and the emulator does the upload and download. No AWS SDK was added to lstk.
  • Credentials aren't stored. lstk registers the bucket with a placeholder URL and sends the real values with each command.
  • snapshot list s3://... needs a running emulator, since the emulator is what reads the bucket.
image

@anisaoshafi anisaoshafi changed the title feat: add S3 remote storage for snapshot save, load, and list Add S3 remote storage for snapshot save, load, and list Jun 26, 2026
@anisaoshafi anisaoshafi added semver: patch docs: needed Pull request requires documentation updates labels Jun 26, 2026
@anisaoshafi
anisaoshafi marked this pull request as ready for review June 26, 2026 17:29
@anisaoshafi
anisaoshafi requested a review from a team as a code owner June 26, 2026 17:29
@gtsiolis

Copy link
Copy Markdown
Member

Thanks @carole-lavillonniere for adding cf00471, I was just about to add you as reviewer. 😁

@carole-lavillonniere

Copy link
Copy Markdown
Collaborator

@anisaoshafi I pushed this small clean-up cf00471, hope that looks fine to you!

What about reading env var AWS_PROFILE (if flag --profile not set)?

If we compare the aws authentication mechanism with CLI v1, we are regressing because we don't support credential_process, SSO and assuming role. However I am not sure how much they are used, if we want to support them, and if yes, they could come in a subsequent PR. Something for you to discuss with the rest of the team? It would be interesting to see usage data.

@anisaoshafi

Copy link
Copy Markdown
Collaborator Author

@anisaoshafi I pushed this small clean-up cf00471, hope that looks fine to you!

What about reading env var AWS_PROFILE (if flag --profile not set)?

If we compare the aws authentication mechanism with CLI v1, we are regressing because we don't support credential_process, SSO and assuming role. However I am not sure how much they are used, if we want to support them, and if yes, they could come in a subsequent PR. Something for you to discuss with the rest of the team? It would be interesting to see usage data.

Good point, and quick win. Will address that, thanks 💯

@anisaoshafi

Copy link
Copy Markdown
Collaborator Author

@anisaoshafi I pushed this small clean-up cf00471, hope that looks fine to you!

What about reading env var AWS_PROFILE (if flag --profile not set)?

If we compare the aws authentication mechanism with CLI v1, we are regressing because we don't support credential_process, SSO and assuming role. However I am not sure how much they are used, if we want to support them, and if yes, they could come in a subsequent PR. Something for you to discuss with the rest of the team? It would be interesting to see usage data.

We decided to simplify the S3 destination support on purpose, discussed in our past planning sessions with product. For now passing the profiles in either of the ways with --profile or via AWS_ACCESS_KEY_ID+ AWS_SECRET_ACCESS_KEY or AWS_PROFILE should be good to go.

anisaoshafi and others added 7 commits June 29, 2026 16:46
Lets users save, load, and list emulator snapshots in their own S3
bucket via an s3:// path, alongside the existing local-file and
platform pod: targets. Credentials come from AWS_* env vars or
--profile; they are never placed in the URL. The emulator performs the
S3 transfer (no AWS SDK in the CLI) and lstk transparently registers a
placeholder-templated remote so secrets stay ephemeral.
s3:// is now a supported load target, so it no longer hits the
"not yet supported" path. Reject S3 in parseCloudOnly so remove/show
(cloud-only, S3 deferred) still error clearly, and add a test that
loading from S3 requires a pod name.
Before save/load/list against an S3 remote, lstk now checks the bucket
exists (unsigned S3 HEAD: 404 => missing) and errors out rather than
letting the emulator silently create it on a typo. Local-testing
endpoints (IP / host.docker.internal) are skipped, and a check that
cannot run degrades to a warning.
Follow AWS CLI precedence in resolveS3Credentials: --profile flag wins,
then static AWS_* env vars, then the profile named by AWS_PROFILE. Add
regression tests covering each precedence rule and the no-credentials error.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@anisaoshafi
anisaoshafi force-pushed the devx-926-add-s3-only-support-for-snapshot-remotes branch from cf00471 to 5df370e Compare June 29, 2026 14:47
@carole-lavillonniere

Copy link
Copy Markdown
Collaborator

@anisaoshafi I pushed this small clean-up cf00471, hope that looks fine to you!
What about reading env var AWS_PROFILE (if flag --profile not set)?
If we compare the aws authentication mechanism with CLI v1, we are regressing because we don't support credential_process, SSO and assuming role. However I am not sure how much they are used, if we want to support them, and if yes, they could come in a subsequent PR. Something for you to discuss with the rest of the team? It would be interesting to see usage data.

We decided to simplify the S3 destination support on purpose, discussed in our past planning sessions with product. For now passing the profiles in either of the ways with --profile or via AWS_ACCESS_KEY_ID+ AWS_SECRET_ACCESS_KEY or AWS_PROFILE should be good to go.

Thanks for sharing the context @anisaoshafi, makes sense!

@anisaoshafi
anisaoshafi merged commit 503e0c9 into main Jun 30, 2026
30 of 35 checks passed
@anisaoshafi
anisaoshafi deleted the devx-926-add-s3-only-support-for-snapshot-remotes branch June 30, 2026 07:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs: needed Pull request requires documentation updates semver: patch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants