This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-10-16
Channels
- # announcements (9)
- # babashka (12)
- # beginners (60)
- # biff (2)
- # calva (4)
- # cider (4)
- # clj-commons (1)
- # clj-kondo (17)
- # clojure (2)
- # clojure-europe (17)
- # clojurescript (15)
- # emacs (18)
- # exercism (5)
- # fulcro (15)
- # holy-lambda (13)
- # joyride (1)
- # lambdaisland (2)
- # malli (1)
- # nbb (3)
- # off-topic (23)
- # polylith (6)
- # portal (59)
- # releases (1)
- # squint (1)
- # tools-deps (4)
Interesting, I wanted to test locally the native-image build, but AWS SAM seemed a bit too much so wipped up a small docker image which has the lambda runtime interface emulator in it:
0% cat Dockerfile.test-native-image
FROM public.ecr.aws/lambda/provided:al2
# Copy custom runtime bootstrap
COPY .holy-lambda/build/bootstrap ${LAMBDA_RUNTIME_DIR}
# Copy function code
COPY .holy-lambda/build/output ${LAMBDA_TASK_ROOT}
# Set the CMD to your handler (could also be done as a parameter override outside of the Dockerfile)
CMD [ "my.lambda" ]
and after building it, ran it with
docker run --rm -p 9000:8080 -e AWS_REGION=us-west-2 my-lambda:1
and since I use https://github.com/99designs/aws-vault#how-it-works for AWS access with a fake EC2 metadata service, it seems that the docker container is able to reach out to the fake local EC2 metadata server and fetch AWS credentials, provided that AWS_REGION
was defined so code that hits AWS inside the lambda seems to work (well, I had only S3 presigning there, but that needs aws keys too)We can extend adapter to support this.
Believe me SAM is very light :D
It does exactly the same thing as you did with docker.
Somehow though IIRC, on my machine the initial docker build took a while Also I guess I just wanted to dive down deep, see what are the bits that make these things 🙂
At first SAM has to download the docker RIE images, therefore first time takes a while.
yeah, I should try again, I think I might have been running just th the jar back then and sam by default restarted the jar with every reqeust which was dog-slow 😄 but then I found out switch for keeping the app alive