chore(docker): ship awslocal wrapper in the -compat image (#746)

* chore(docker): ship awslocal wrapper in the -compat image

bin/awslocal was added to the repo in #638 but is not COPYed into any of
the published Docker images. That makes existing LocalStack init scripts
mounted at /etc/localstack/init/ready.d/ — which overwhelmingly use
`awslocal kinesis …` rather than `aws --endpoint-url=… kinesis …` —
fail with "command not found" on the supposedly drop-in -compat image.

The script also needed an entry in .dockerignore: the file is allow-list
style ("*" + "!path") and bin/awslocal was not in the allow list, so it
never reached the build context. Without that line the COPY fails with
"file not found in build context".

Closes #744. The orthogonal SQS endpoint-resolver issue tracked in #745
is unaffected by this change — awslocal as written only exports
AWS_ENDPOINT_URL, which the bundled botocore silently ignores for SQS.

* fix(awslocal): pass --endpoint-url explicitly to honor hard-pin contract

LocalStack's awslocal idiom is "hard-pin the endpoint" — that's the whole
point of the wrapper. Setting AWS_ENDPOINT_URL alone is not sufficient:
the bundled aws-cli/1.44.87 + botocore/1.42.97 silently bypasses the env
var for SQS via service-specific endpoint resolvers, sending requests
to public AWS. With real credentials in CI/dev, that would silently
provision real SQS queues — surfacing as the InvalidClientTokenId error
documented in #745.

Inject --endpoint-url before "$@" so the user's own --endpoint-url (if
any) still wins via last-flag-wins. Verified: awslocal sqs create-queue
and list-queues now route to Floci; kinesis/s3 still work; awslocal env
subcommand unaffected; user override behaves correctly.

Addresses Copilot's review feedback on #746 and the awslocal arm of #745.
This commit is contained in:
Niklas Herder authored and GitHub committed 2026-05-08 07:48:21 -05:00
1 parent ccac5f63fd
commit 97b08f62bc
3 files changed
+8 -1

No files matched your search

+1
View File
@@ -1,4 +1,5 @@
*
!bin/awslocal
!docker/entrypoint.sh
!docker/localstack-parity.sh
!pom.xml
+4 -1
View File
@@ -27,4 +27,7 @@ export AWS_ACCESS_KEY_ID="${AWS_ACCESS_KEY_ID:-test}"
export AWS_SECRET_ACCESS_KEY="${AWS_SECRET_ACCESS_KEY:-test}"
export AWS_DEFAULT_REGION="${_REGION}"
exec aws "$@"
# Pass --endpoint-url explicitly: a few SDKs/services (notably SQS in older
# botocore) silently bypass AWS_ENDPOINT_URL via service-specific endpoint
# resolvers, sending the call to public AWS instead of Floci.
exec aws --endpoint-url "${_ENDPOINT}" "$@"
+3
View File
@@ -13,4 +13,7 @@ RUN microdnf install -y --nodocs python3 python3-pip \
&& microdnf clean all \
&& rm -rf /root/.cache/pip
COPY bin/awslocal /usr/local/bin/awslocal
RUN chmod +x /usr/local/bin/awslocal
USER 1001