Skip to content

Instantly share code, notes, and snippets.

View AntoniusGolly's full-sized avatar

Antonius Golly AntoniusGolly

  • Berlin, Germany
View GitHub Profile
import { Stack, StackProps} from 'aws-cdk-lib';
import { Construct } from 'constructs';
import * as lambda from 'aws-cdk-lib/aws-lambda-nodejs'
import * as apigateway from 'aws-cdk-lib/aws-apigateway'
import { LambdaIntegration } from './LambdaIntegration'
export class LegacyWrapperStack extends Stack {
constructor(scope: Construct, id: string, props?: StackProps) {
super(scope, id, props);
@AntoniusGolly
AntoniusGolly / LambdaIntegration.ts
Last active May 20, 2022 01:39
LambdaIntegration
import * as iam from 'aws-cdk-lib/aws-iam';
import * as lambda from 'aws-cdk-lib/aws-lambda';
import * as apigateway from 'aws-cdk-lib/aws-apigateway';
export interface LambdaIntegrationOnePermissionOnlyOptions extends apigateway.LambdaIntegrationOptions {
restApi: apigateway.IRestApi
}
export class LambdaIntegration extends apigateway.LambdaIntegration {
@AntoniusGolly
AntoniusGolly / index.js
Created March 18, 2018 17:17
Sample Node.js script for resizing images with the Sharp library
'use strict';
const AWS = require('aws-sdk');
const S3 = new AWS.S3({
signatureVersion: 'v4',
});
const sharp = require('sharp');
const BUCKET = process.env.BUCKET ? process.env.BUCKET : "mybucket";
const URL = process.env.URL ? process.env.URL : "http://localhost:5858"; // for local development
@AntoniusGolly
AntoniusGolly / policy.json
Last active March 18, 2018 17:22
Basic policy for lambda function execution with rights to access S3 bucket and logs
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"logs:CreateLogGroup",
"logs:CreateLogStream",
"logs:PutLogEvents"
],