Skip to content

Instantly share code, notes, and snippets.

@rogerchi
rogerchi / ddb-sessions.server.ts
Created December 31, 2022 15:05
Using DynamoDB for sessions in remix (File sessions in local dev)
import { DynamoDBClient } from '@aws-sdk/client-dynamodb'
import { DeleteCommand, DynamoDBDocumentClient, GetCommand, PutCommand, UpdateCommand } from '@aws-sdk/lib-dynamodb'
import { Cookie, createCookie, createFileSessionStorage, createSessionStorage, SessionStorage } from '@remix-run/node'
import { v4 as uuidv4 } from 'uuid'
import { getEnv } from '~/utils/get-env'
const LOCAL_DEV = process.env.LOCAL_DEV === 'true'
if (LOCAL_DEV) {
@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 {
@rogerchi
rogerchi / athena-view.ts
Created August 10, 2021 16:17
Create Athena View using CfnNamedQuery
// CfnDatabase from @aws-cdk/aws-glue
const db = new CfnDatabase(this, 'DB', {
catalogId: this.account,
databaseInput: {},
});
const dbName = db.ref;
const createOrRelaceViewQuery = new CfnNamedQuery(
this,