The latest project I am working on requires us to set up a number of cloud services on AWS. While I have some experience doing that on Google Cloud Platform, the AWS system and tooling are a learning experience.
This week we are setting up a number of AWS Lambdas. We are trying to do this right from day one by enabling unit/integration tests and automated build systems from the start. We also made the choice to start immediately with TypeScript rather than migrate to it over time as we have done in other projects.
I tried using the AWS SAM CLI for creating the Lambdas today. There were a couple of hiccups that I wanted to share here.
1. Typescript templates are only available in ZIP-based deployments
I was glad to see that the SAM CLI allowed for the creation of TypeScript based projects out of the box. What took me a long time to realize was that the TypeScript templates only appear as options if you use the ZIP-based package type. I tried various combinations of node versions, etc before trying the zip based option which finally worked. There are also way too many tutorials on the web that start you out with a JS based project and then you add a number of config changes to migrate to TS which is a pain.
2. Colima-based hiccups
Most of the tutorials I found using SAM required you to use Docker Desktop, which unfortunately is no longer an option at work given their new licensing terms.
Thankfully this gist helped set up a local environment using Colima that seemed to work at first.
The only problem was that trying to test the code locally did not work as the local connections to the container would timeout without being able to connect. This turned out to be caused by Colima not enabling reachable IP addresses by default for performance reasons. Restarting Colima with
colima start --network-address fixed this but I only discovered this after a couple of hours of banging my head against the computer.
Ah well, things are working right now and I need to get home 👋