Skip to content

Instantly share code, notes, and snippets.

View maoosi's full-sized avatar

Sylvain maoosi

View GitHub Profile
@DavidWells
DavidWells / conditional-resources.yml
Last active June 28, 2021 15:46
Using conditional "Fn::Equals" for cloudformation resources. From https://github.com/KlickMarketing/demo-site/blob/master/serverless.yml#L55 including no value
resources:
Description: Demo Site
Conditions:
isProd: {"Fn::Equals" : ["${self:custom.stageFlag}", "prod"]}
isRC: {"Fn::Equals" : ["${self:custom.stageFlag}", "rc"]}
isDev: {"Fn::Equals" : ["${self:custom.stageFlag}", "dev"]}
isProdOrRC: {"Fn::Or": [{"Condition": "isProd"}, {"Condition": "isRC" }]}
Resources:
ProxyEntry:
Type: 'Custom::MarketingStackProxyEntry'
@archisgore
archisgore / aws-cdk-s3-notification-from-existing-bucket.ts
Last active June 17, 2021 12:44
AWS CDK add notification from existing S3 bucket to SQS queue
import * as cr from '@aws-cdk/custom-resources';
import * as logs from '@aws-cdk/aws-logs';
import * as s3 from '@aws-cdk/aws-s3';
import * as sqs from '@aws-cdk/aws-sqs';
import * as iam from '@aws-cdk/aws-iam';
import {Construct} from '@aws-cdk/core';
// You can drop this construct anywhere, and in your stack, invoke it like this:
// const s3ToSQSNotification = new S3NotificationToSQSCustomResource(this, 's3ToSQSNotification', existingBucket, queue);
@dtelaroli
dtelaroli / lambda-get-identity-id.js
Created August 4, 2020 17:18
How to get identity id from cognito with jwt token
// npm install await-to-js
const { to } = require("await-to-js");
const { CognitoIdentity } = require("aws-sdk");
const identity = new CognitoIdentity();
const IDENTITY_POOL_ID = "<your identity pool id>";
exports.handler = async (event) => {
const { issuer } = event.identity;