Andromeda Functions Explainer
June 6, 2020
Functions As A Service, done my way with Andromeda
In my last post, I talked about Andromeda Containers and how Docker with Kubernetes is one of my favourite ways to do things. Well my next favourite thing is Serverless or Function As A Service. To get it out right off the bat, I tend to never refer to these products as serverless. There are still servers there, it’s just you don’t see them. Function / FaaS more gets across what it should be, a small unit of code that does a job. For me, getting Functions right with Lambda on AWS was always a challenge for me, which is why I set out to do this piece of Andromeda.
The main aim was to be able to support schedule-based functions. I like to break functions into different categories and the next logical step for me is your standard API function that gets a request and does something with that request. I still need to learn about and understand API Gateway before I can do this. Nevertheless, there is still many tasks you can do on a scheduled basis, which are perfect candidates for Functions. I have these standard CloudWatch Events that are basically just cron expressions. For the function I am developing, I decide what rate do I need this executed. For some it could be every day, just on the weekend or what have you. That is my trigger handled and yes, not terraformed just yet. My main objective is to Terraform the Lambda function.
Terraforming the Lambda function was not all too tricky. Overall, I took the same approach with Containers as I did Functions. Have some Terraform modules for the development lifecycles I work on and expose the variables that may ever need to get changed with a Function. One additional item I did decide to support was VPC endpoints, so my Lambda functions are not connected to the Internet by default. But once that was handled, it was just a matter of deciding what to expose to the top level. I included things like the function name and the code itself, but I also included the likes of runtime, memory amount and timeout. I targeted Java for now, but I do want to include other languages down the line, so I kept this in mind when I was writing the code.
Once I had everything in place, I could create Lambda functions with more ease than before, but I still had the same stumbling block in my past attempts of CI and CD for Lambda. I do not know why, but I just always found it challenging, especially trying to use the AWS specific services for this (I hold on to my CodeBuild / CodePipeline knowledge with a bit of pride). So, for the most part, I avoided them entirely when figuring this out. Andromeda Build & Deploy encompasses everything related to CI/CD and I will be talking about that soon. But for the most part, I just have a Github Action that does a Gradle build, then uses the Lambda portion of the AWS CLI to deploy the built package to the intended function. Relatively quick and dirty all things considered.
Once I have finished covering all the components of Andromeda so far, I will talk about some code that I’ve written and deployed with Andromeda, which will showcase how everything works together in a (relatively) nice package!
Thank you!
You could of consumed content on any website, but you went ahead and consumed my content, so I'm very grateful! If you liked this, then you might like this other piece of content I worked on.
How my code gets built and deployedPhotographer
I've no real claim to fame when it comes to good photos, so it's why the header photo for this post was shot by Taylor Vick . You can find some more photos from them on Unsplash. Unsplash is a great place to source photos for your website, presentation and more! But it wouldn't be anything without the photographers who put in the work.
Find Them On UnsplashSupport what I do
I write for the love and passion I have for technology. Just reading and sharing my articles is more than enough. But if you want to offer more direct support, then you can support the running costs of my website by donating via Stripe. Only do so if you feel I have truly delivered value, but as I said, your readership is more than enough already. Thank you :)
Support My Work