Skip to content

Instantly share code, notes, and snippets.

@joshbalfour
joshbalfour / rds-global-database-cluster.ts
Last active February 7, 2024 16:47
RDS Global Database Cluster CDK example
import { DatabaseCluster, CfnGlobalCluster, DatabaseClusterProps, CfnDBCluster } from 'aws-cdk-lib/aws-rds'
import { Construct } from 'constructs'
export class GlobalDatabaseCluster extends DatabaseCluster {
public readonly globalCluster: CfnGlobalCluster
constructor(scope: Construct, id: string, props: DatabaseClusterProps) {
super(scope, id, props)
this.globalCluster = new CfnGlobalCluster(this, 'global-cluster', {
@rogerchi
rogerchi / cdk-websocket-with-domain.ts
Created August 23, 2021 13:04
CDK Websocket Domain Name example
import * as path from 'path';
import * as apigatewayv2 from '@aws-cdk/aws-apigatewayv2';
import * as apigatewayv2Integrations from '@aws-cdk/aws-apigatewayv2-integrations';
import * as certificatemanager from '@aws-cdk/aws-certificatemanager';
import * as lnjs from '@aws-cdk/aws-lambda-nodejs';
import * as route53 from '@aws-cdk/aws-route53';
import * as alias from '@aws-cdk/aws-route53-targets';
import * as cdk from '@aws-cdk/core';
export interface WebsocketExampleProps {
@lmakarov
lmakarov / lambda-basic-auth.js
Created August 30, 2017 19:15
Basic HTTP Authentication for CloudFront with Lambda@Edge
'use strict';
exports.handler = (event, context, callback) => {
// Get request and request headers
const request = event.Records[0].cf.request;
const headers = request.headers;
// Configure authentication
const authUser = 'user';
const authPass = 'pass';