Cloudy is a set of constructs for the AWS Cloud Development Kit that aim to improve the DX by providing a faster and type-safe code environment.

Overview

cloudy-ts

These packages aren't yet published on npm. This is still highly experimental. Need to figure out a few things before releasing the first version:

  • Define a good Github Actions workflow (linting, testing, auto releases, auto upgrades, etc)
  • Explore a few more typed constructs and clients
  • Move to a Github Organization
  • Add some more documentation

Cloudy is a set of constructs for the AWS Cloud Development Kit that aim to improve the DX by providing a faster and type-safe code environment.

Design Goals

  • Use ESM modules along with a subset of TypeScript that doesn't generate code and can be striped away. This will come in handy if the Type Annotations Proposal gets accepted.
  • Consistency with the AWS CDK constructs: offer the same API for constructs, but enhanced with types
  • Consistency with the AWS SDK v3: offer the same API for clients, but enhanced with types

Example

Publishing typed messages on a topic using an inline lambda function

import * as cdk from "aws-cdk-lib"
import * as cloudy from "@cloudy-ts/cdk"
import { SNSClient, PublishCommand } from "@cloudy-ts/client-sns"

const app = new cdk.App()

const stack = new cdk.Stack(app, "cloudy-playground")

const topic = new cloudy.aws_sns.Topic(stack, "topic").withMessageType<
  "Hello" | "World!"
>()

const sns = new SNSClient({})
const publishMessage = new cloudy.aws_lambda.Function(stack, "function", {
  async handler() {
    await sns.send(
      new PublishCommand({
        TopicArn: topic.topicArn,
        Message: "Hello",
      }),
    )
    await sns.send(
      new PublishCommand({
        TopicArn: topic.topicArn,
        Message: "World!",
      }),
    )
  },
})
topic.grantPublish(publishMessage)

Explanation

The cloudy.aws_lambda.Function is a CDK Lambda Function construct that uses Pulumi's Function Serialization to generate the asset code for the lambda.

The important part of the implementation lives in packages/cdk/src/aws-lambda/code-from-function.ts. It calls pulumi.runtime.serializeFunction to generate the serialized function code, while gathering all the CloudFormation tokens that are accessed (such as queue URLs, queue ARNs, table names, etc.). The CloudFormation tokens are then replaced by environment variables.

The packages/cdk/src/aws-lambda/function.ts is just a copy&paste of the original cdk.aws_lambda.Function that resolves the asset code asynchronously. This is necessary due to pulumi.runtime.serializeFunction being an async function. It would be great if the original construct just allowed us to pass a Promise<cdk.aws_lambda.AssetCode> instead.

Further improvements

The idea of this project is to leverage the TypeScript typing system and provide type-enhanced CDK constructs such as cloudy.aws_sns.Topic, cloudy.aws_sqs.Queue, cloudy.aws_dynamodb.Table, etc. as well as type-enhanced AWS SDK v3 client. In conjunction, it would allow a supreme developer experience.

Huge thanks to Sam Goodwin to promote this movement. See their projects:

Try the playground

Install with yarn:

yarn install

Then, go to the playground folder and follow the instructions in there.

Contributing

Setup

Install dependencies:

yarn install

Enable Git hooks:

yarn husky install

Start testing:

yarn ava --watch

Lint

yarn eslint --ext js,mjs,cjs,ts,mts,cts .

Update Dependencies

yarn up && yarn up -R

Interactive, with the latest versions:

yarn upgrade-interactive

Release

yarn turbo run lint test build
yarn standard-version # --first-release
git push --folow-tags origin main
You might also like...

Denail of service system for the Dentistimo system. Used to improve the tolerance and testing fail safe functionality.

 Denail of service system for the Dentistimo system. Used to improve the tolerance and testing fail safe functionality.

Distributed Systems - Dos Testing DoS (Denail of Service) System for Testing and Practical demonstration of systems capability to handle a basic DDoS

Nov 8, 2022

Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

May 18, 2022

Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

May 3, 2022

Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

Jan 3, 2023

CDK constructs for self-hosted GitHub Actions runners

GitHub Self-Hosted Runners CDK Constructs Use this CDK construct to create ephemeral self-hosted GitHub runners on-demand inside your AWS account. Eas

Dec 20, 2022

A VS Code extension to practice and improve your typing speed right inside your code editor. Practice with simple words or code snippets.

A VS Code extension to practice and improve your typing speed right inside your code editor. Practice with simple words or code snippets.

Warm Up 🔥 👨‍💻 A VS Code extension to practice and improve your typing speed right inside your code editor. Practice with simple words or code snipp

Dec 12, 2022

A JavaScript module that shortens your code, makes life easier, and makes development faster!

Quxt A JavaScript module that shortens your code, makes life easier, and makes development faster! Installation npm install quxt Quick Start Check ind

May 8, 2022

The aim of this project is to restructure the Awesome books app code by using ES6 syntax and organising the workspace using modules.

Awesome-Books-ES6 The aim of this project is to restructure the Awesome books app code by using ES6 syntax and organising the workspace using modules.

Aug 18, 2022

this project's main aim is to restructure Awesome books app code to make it more organized by using modules and also practicing the ES6 syntax.

Awesome Books ES6 this project's main aim is to restructure Awesome books app code to make it more organized by using modules. also practicing the ES6

Sep 6, 2022
Releases(v0.0.209)
Owner
Cristian Pallarés
Cristian Pallarés
A monorepo that uses the AWS Cloud Development Kit to deploy and configure nanomdm on AWS lambda.

NanoMDM on AWS This repo builds and configures a nanomdm server to run on AWS lambda. It uses the Cloud Development Kit and tries to follow best pract

Stevie Clifton 4 May 26, 2022
MerLoc is a live AWS Lambda function development and debugging tool. MerLoc allows you to run AWS Lambda functions on your local while they are still part of a flow in the AWS cloud remote.

MerLoc MerLoc is a live AWS Lambda function development and debugging tool. MerLoc allows you to run AWS Lambda functions on your local while they are

Thundra 165 Dec 21, 2022
Under the Sea is an official AWS workshop delivered by AWS SAs and AWS Partners to help customers and partners to learn about AIOps with serverless architectures on AWS.

Under the Sea - AIOps with Serverless Workshop Under the Sea is an exciting MMORPG developed by the famous entrepreneur behind Wild Rydes, the most po

AWS Samples 4 Nov 16, 2022
Learn Web 2.0 and Web 3.0 Development using Next.js, Typescript, AWS CDK, AWS Serverless, Ethereum and AWS Aurora Serverless

Learn Web 2.0 Cloud and Web 3.0 Development in Baby Steps In this course repo we will learn Web 2.0 cloud development using the latest state of the ar

Panacloud Multi-Cloud Internet-Scale Modern Global Apps 89 Jan 3, 2023
Easy-to-use CDK constructs for monitoring your AWS infrastructure

CDK Monitoring Constructs Easy-to-use CDK constructs for monitoring your AWS infrastructure. Easily add commonly-used alarms using predefined properti

CDK Labs at AWS 214 Jan 6, 2023
Framework agnostic CLI tool for routes parsing and generation of a type-safe helper for safe route usage. 🗺️ Remix driver included. 🤟

About routes-gen is a framework agnostic CLI tool for routes parsing and generation of a type-safe helper for safe route usage. Think of it as Prisma,

Stratulat Alexandru 192 Jan 2, 2023
AWS Lambda & Serverless - Developer Guide with Hands-on Labs. Develop thousands line of aws lambda functions interact to aws serverless services with real-world hands-on labs

AWS Lambda & Serverless - Developer Guide with Hands-on Labs UDEMY COURSE WITH DISCOUNTED - Step by Step Development of this Repository -> https://www

awsrun 35 Dec 17, 2022
mirrord lets you easily mirror traffic from your production environment to your development environment.

mirrord lets you easily mirror traffic from your Kubernetes cluster to your development environment. It comes as both Visual Studio Code extension and a CLI tool.

MetalBear 2.1k Dec 24, 2022
100% type-safe query builder for node-postgres :: Generated types, call any function, tree-shakable, implicit type casts, and more

⚠️ This library is currently in alpha. Contributors wanted! tusken Postgres client from a galaxy far, far away. your database is the source-of-truth f

alloc 54 Dec 29, 2022