Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a layer to simplify deploying to AWS Lambda #728

Open
ramnivas opened this issue Apr 26, 2023 · 3 comments
Open

Provide a layer to simplify deploying to AWS Lambda #728

ramnivas opened this issue Apr 26, 2023 · 3 comments

Comments

@ramnivas
Copy link
Contributor

ramnivas commented Apr 26, 2023

Currently, we bundle the bootstrap binary along with exo_ir. Instead, we could make bootstrap a layer. This way, developer will need to push just the "exo_ir" file.

We will have to resolve how to specify a version of the layer to match the one that built the exo_ir file.

@MinisculeGirraffe
Copy link

MinisculeGirraffe commented Nov 16, 2023

My 2 cents on this as someone who does a lot of stuff in AWS/Lambda. The pattern you guys use is wrong.

I NEVER want the exograph command line to touch my AWS resources.

The right pattern is you really should have a CDK construct to manage all of this.

 new ExoGraphLambda(this, "My API", {
      code: lambda.Code.fromAsset(path.join(__dirname, 'exograph_schema')) // Path to the exograph schema,
      exograph_version: "Some constant" 
      enviroment: {} // known exograph envrioment variables
})

That's basically all that's needed to handle this. You can just manage the layer from inside the construct and don't even have to expose that complexity to the consumer.

Similar patterns exist in cargo-lambda to inject build-steps into the deployment.

@MinisculeGirraffe
Copy link

MinisculeGirraffe commented Nov 16, 2023

The second benefit to using a CDK construct is something I would really recommend to call out in the documentation.

Lambda is billed per invocation and for execution duration. So with a function URL, you're billed per HTTP request regardless if the lambda just immediately stops executing. So someone can just DDOS me out of my paycheck by spamming the URL with unauthenticated requests.

With a CDK construct you can easily integrate the lambda with AWS WAF to ratelimit the execution so that can't happen. Cloudflare is also a decent option that's free for also.

@ramnivas
Copy link
Contributor Author

@MinisculeGirraffe Thanks for your input. Indeed, using CDK will improve user experience (in addition to the benefits you listed).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants