#anyone have a modern container workflow for the serverless framework?
11 messages · Page 1 of 1 (latest)
Specifically getting it working with serverless framework ; the terminology in this space is HORRENDOUS
You can use the image and docker file to deploy using Serverless framework
http://serverless.com//blog/container-support-for-lambda
https://github.com/hayd/deno-lambda/tree/master/example-serverless
We usted to have deno api running on AWS LAMBDA with the combination of this articles and a more simplier Serverless yml
Give it a read to the repository and the article it was pretty simple, we moved to deno deploy due the lower cold starts, thats why currently i dont have an example, let me know if u cant to try to setup a basic example
Unfortunately I have a codified requirement to utilize serverless for 100% of AWS infra at my company 😭
There’s hardline requirements for access to internal networks no meshing nothing allowed
I did find and old test trying to use OAK https://github.com/fro-profesional/POC/tree/main/aws-deno
Let me know if it helps
But in short:
Define serverless.yml | .ts | .js
// serverless.js (you can use yml also)
const name = "deno-lambda-test";
let config = {
service: name,
provider: {
name: "aws",
ecr: { images: { [name]: { path: "./" } } },
},
functions: {
service: {
image: { name },
events: [{ httpApi: "*" }],
},
},
};
module.exports = config;
Define Dockerfile
//Dockerfile
FROM hayd/deno-lambda:1.29.1
COPY . .
RUN deno cache lambda.ts
CMD ["lambda.handler"]
Define handler
//lambda.ts
import {
APIGatewayProxyEventV2,
APIGatewayProxyResultV2,
Context,
} from "https://deno.land/x/lambda@1.28.3/mod.ts";
const handler = async (
event: APIGatewayProxyEventV2,
context: Context
): Promise<APIGatewayProxyResultV2> => {
return {
body: JSON.stringify({
message: "hello-world"
}),
headers: {
"content-type": "application/json",
"Access-Control-Allow-Origin": "*",
},
statusCode: 200,
};
};
export { handler };