Skip to content

Instantly share code, notes, and snippets.

View alexkates's full-sized avatar

alexkates alexkates

View GitHub Profile
@alexkates
alexkates / copilot-instructions.md
Last active November 10, 2025 13:57
Next.js copilot-instructions

Copilot Instructions

🧠 Role

You are an expert frontend engineer using TypeScript, Next.js App Router, React (RSC + Server Actions), shadcn/ui, Radix UI, and Tailwind CSS.
Use the latest stable versions of all libraries.


⚙️ General Rules

// Import aws-cdk packages
import * as cdk from '@aws-cdk/core';
import * as s3 from '@aws-cdk/aws-s3';
import * as lambda from '@aws-cdk/aws-lambda';
import * as lambdaEventSources from '@aws-cdk/aws-lambda-event-sources';
export class HowToTriggerLambdaFromS3Stack extends cdk.Stack {
constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);
aws dynamodb put-item \
--table-name Table \
--item '{
"id": {"S": "test123"}
}'
// Import aws-cdk packages
import * as cdk from '@aws-cdk/core';
import * as dynamodb from '@aws-cdk/aws-dynamodb';
import * as lambda from '@aws-cdk/aws-lambda';
import { DynamoEventSource } from '@aws-cdk/aws-lambda-event-sources';
export class HowToTriggerLambdaFromDdbStreamStack extends cdk.Stack {
constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);
aws sqs get-queue-url --queue-name OurSQSQueue
@alexkates
alexkates / index.js
Last active July 4, 2021 11:23
Log all event records passed into Lambda
/**
* Loop over each event record and log to the console.
* Since this is a Lambda Function, the log statements will
* also be logged to CloudWatch.
*/
exports.handler = async (event) => {
event.Records.forEach((record) => {
console.log('Record: %j', record);
});
@alexkates
alexkates / how-to-trigger-lambda-from-sqs-stack.ts
Last active January 11, 2025 00:53
How to Trigger an AWS Lambda from SQS using the AWS CDK
// Import aws-cdk packages
import * as cdk from '@aws-cdk/core';
import * as sqs from '@aws-cdk/aws-sqs';
import * as lambda from '@aws-cdk/aws-lambda';
import * as lambdaEventSources from '@aws-cdk/aws-lambda-event-sources';
export class HowToTriggerLambdaFromSqsStack extends cdk.Stack {
constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);