strongishllama / faasd-cdk

This project contains CDK constructs to deploy the faasd on AWS.

Home Page:https://npmjs.com/package/@strongishllama/faasd-cdk

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AWS AMI should be configurable

22phuber opened this issue · comments

Hi @strongishllama,

I wanted to try your aws cdk setup the coming days although i'm not yet familiar with the cdk but with lots of other AWS services.

One thing that will probably be an issue when deploying to another region is the AMI (afaik the AMIs are regional) e.g. this line here:
=> https://github.com/strongishllama/faasd-cdk/blob/main/lib/index.ts#L70

machineImage: ec2.MachineImage.genericLinux({ 'ap-southeast-2': 'ami-0567f647e75c7bc05' }),

Would it be possible to change the line to something like:

machineImage: ec2.MachineImage.genericLinux({ [props.region]: props.amiId }),

... even better would be to lookup the AMI for the specified region, if that is possible.

But anyway, thanks for sharing your code 👍

I'll try to deploy this the next days and will maybe come back with additional informations

@22phuber good spotting. I'm happy to add the AMI ID as a property, I'll look at implementing this tomorrow morning.

I know you can do lookups for the latest Amazon Linux AMIs via Systems Manager Parameter Store but I'm not sure if you can do it with Ubuntu based images. Maybe, something to look into in the future.

Another option I'd like to look into is using EC2 image builder to build nightly AMIs that could be distributed across all regions. I was hoping to do it in CDK though and the NPM module has only L1 constructs.