Install any skill in seconds. Free to start, no credit card required.
Get Started Free →AWS SAM and CDK guidance for scaffolding, templating, deploying, and CI/CD of serverless applications on AWS.
Use this skill ↓78% 83%+4 ptsof test cases passed
Passed 19 of 23 test cases with the skill, and 18 of 23 without it.
3 of 3 safety checks passed
Not used yet
Common CDK patterns for serverless applications. Each example uses L2 constructs with grant* methods for least-privilege IAM.
Creates an HTTP API with CORS configuration and Lambda integration for handling REST endpoints.
import * as apigwv2 from 'aws-cdk-lib/aws-apigatewayv2';
import { HttpLambdaIntegration } from 'aws-cdk-lib/aws-apigatewayv2-integrations';
const api = new apigwv2.HttpApi(this, 'OrderApi', {
corsPreflight: {
allowOrigins: ['https://myapp.example.com'],
allowMethods: [apigwv2.CorsHttpMethod.GET, apigwv2.CorsHttpMethod.POST],
allowHeaders: ['Content-Type', 'Authorization'],
},
});
api.addRoutes({
path: '/orders',
methods: [apigwv2.HttpMethod.POST],
integration: new HttpLambdaIntegration('CreateOrder', createOrderFunction),
});
new cdk.CfnOutput(this, 'ApiUrl', { value: api.apiEndpoint });
Exposes a Lambda function directly via HTTPS with optional IAM auth and streaming support.
const fnUrl = myFunction.addFunctionUrl({
authType: lambda.FunctionUrlAuthType.NONE, // or AWS_IAM
invokeMode: lambda.InvokeMode.RESPONSE_STREAM, // for streaming
cors: {
allowedOrigins: ['https://myapp.example.com'],
allowedMethods: [lambda.HttpMethod.POST],
Skills that do similar work, with their benchmark result.
Next to this one in the catalogue, plus more from the same author.