Skip to content

Choosing the right Ubuntu AMI for EC2

As part of setting up an app on an EC2 instance on AWS I wanted to try out Amazon Linux. Picking the latest compatible Amazon Linux AMI using CDK is easy: However, Amazon Linux isn’t always the right choice. What is Amazon Linux? It’s not Ubuntu, it’s Fedora (also, Amazon Linux 2 is older than 2023): Why? I have no idea. I’ve done a lot of random stuff in my time as a developer, and running into Fedora is not one of them. When I ran my ansible scripts against the gravitron fedora box it immediately failed: I was attempting to use ansible-dokku with Amazon Linux 2023, which explicitly is not supported. Gravitron-supported OS are listed here and included Ubuntu, so it was time to use an Unbuntu image…

Continue Reading

Passing Environments Variables to EC2 Instances using AWS CDK

I was updating an older project that ran using dokku and hosted an Elixir/Phoenix application with a postgres database. Uptime and other normally important things didn’t matter, so I just wanted to host the database and application on a small EC2 instance. However, the application got complex enough (SQS queues, some lambdas, etc) that I wanted to pass the SQS endpoints automatically to the EC2 instances via environments. Should be easy, right? This feels like a very common use case. I struggled to find a solution to this problem that Just Worked…

Continue Reading

Deploying Nodejs on AWS Lambda using NodejsFunction

I wanted to deploy a node lambda on AWS using CDK. The NodejsFunction seemed like an improvement over using the standard Function construct: the CDK SDK would bundle your code for you, in a docker container running the same version of node used in the lambda. Instead of defining a code param you define an entry file that is used for the compilation process. This seems like a great improvement over copy/pasting your local nodejs application (including the local node_modules!) into the lambda…

Continue Reading