This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Code, Function, Runtime } from '@aws-cdk/aws-lambda'; | |
| import * as cdk from '@aws-cdk/core'; | |
| export class GoLambdaStack extends cdk.Stack { | |
| constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) { | |
| super(scope, id, props); | |
| // The code that defines your stack goes here | |
| new Function(this, 'goLambda', { | |
| runtime: Runtime.GO_1_X, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "lambdaARN": "arn:aws:lambda:us-east-1:123567890:function:lambda-cost-6cvNuq95XpKYZbM6-getTodoFn01C9D3BC-gEAFh9acFv8PunBf", | |
| "powerValues": [ | |
| 128,256,512,1024,2048 | |
| ], | |
| "num": 10, | |
| "payload": { | |
| "body": "{\"id\": \"58dcfe41-cc3f-4f5b-afbf-d69ef4908bae\"}" | |
| }, | |
| "parallelInvocation": true, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { APIGatewayProxyEventV2, APIGatewayProxyResultV2 } from 'aws-lambda' | |
| export async function myFunction(event: APIGatewayProxyEventV2): Promise<APIGatewayProxyResultV2> { | |
| return { | |
| statusCode: 200, | |
| body: JSON.stringify({ message: 'hello from ts lambda' }) | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| new ARecord(this, 'apiAliasRecord', { | |
| zone: hostedZone, | |
| target: RecordTarget.fromAlias(new ApiGatewayv2Domain(domain)) | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { APIGatewayProxyEventV2, APIGatewayProxyResultV2 } from "aws-lambda"; | |
| import { DynamoDB, PutItemInput } from '@aws-sdk/client-dynamodb' | |
| import { marshall } from '@aws-sdk/util-dynamodb' | |
| import { v4 as uuid } from 'uuid' | |
| interface TodoInput { | |
| id?: string | |
| title: string | |
| done: boolean | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| exports.discountForProduct = (productId) => { | |
| const products = [ | |
| { | |
| productId: '1', | |
| discount: '10%' | |
| }, | |
| { | |
| productId: '2', | |
| discount: '20%' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # https://taskfile.dev | |
| version: '3' | |
| tasks: | |
| default: | |
| cmds: | |
| - rm deployment.zip -f | |
| - zip deployment.zip index.js |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM ubuntu:20.04 | |
| RUN apt-get update && apt-get install wget git xz-utils -y | |
| RUN mkdir -p /home/apoorvmote/website/ | |
| WORKDIR /home/apoorvmote/website/ | |
| EXPOSE 1313 |
NewerOlder