Skip to content

Instantly share code, notes, and snippets.

View fredericbarthelet's full-sized avatar

Frédéric Barthelet fredericbarthelet

View GitHub Profile
@fredericbarthelet
fredericbarthelet / intrinsic.ts
Created October 11, 2020 15:17
AWS intrinsic function resolution
import {
CloudFormationResource,
CloudFormationResources,
} from 'serverless/aws';
import { findKey } from 'lodash';
interface CloudFormationReference {
Ref: string;
}
@fredericbarthelet
fredericbarthelet / create.ts
Last active June 30, 2021 19:27
Lamba create.ts with intrinsic service
import { DynamoDB } from 'aws-sdk';
import { ref } from './intrinsic';
import cloudformationResources, { MyTable } from './resources';
export default {
handler:'create.main',
environment: {
TABLE_NAME: ref(cloudformationResources, MyTable)
},
@fredericbarthelet
fredericbarthelet / serverless.ts
Created April 28, 2022 15:50
Serverless to CDK bridge with HttpApi extension
import type { AWS } from '@serverless/typescript';
import { App, Stack, Fn } from 'aws-cdk-lib';
// import { CfnApiMapping } from 'aws-cdk-lib/aws-apigatewayv2'
import { Certificate } from 'aws-cdk-lib/aws-certificatemanager'
import { ApiMapping, DomainName, HttpApi, HttpStage } from '@aws-cdk/aws-apigatewayv2-alpha';
const app = new App();
class MyStack extends Stack {
constructor(scope, id) {
super(scope, id);