
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
@awsless/awsless
Advanced tools
Awsless - Infrastructure as a code
๐ชถ AWS development using JSON config with best practices baked in
โก Deploy APIs, functions, databases, queues, and more โ all in one place
๐ Secure by default with IAM-based permissions and least privilege
๐ First-class support for AWS Lambda, DynamoDB, SQS, EventBridge, and more
๐งช Built-in local development and testing utilities
๐ Automatic function bundling with support for ES modules and TypeScript
๐ Types generatation for all resources that can be acessed anywhere in the code
Using npm:
$ npm i @awsless/awsless
Using pnpm:
$ pnpm i @awsless/awsless
In an Awsless project, your infrastructure is organized into modular stack files, each with its own purpose, and a shared base configuration. Before you begin, make sure you have the AWS CLI installed.
This is your shared app configuration, which acts as the base stack for the entire project. This should exist in the root of your project.
app.json
{
"name": "hello-world",
"region": "eu-west-1",
"profile": "test",
"defaults": {
"alerts": {
"debug": "hello@gmail.com"
}
}
}
๐ Key Fields
name: Name of your application.
region: AWS region where you want to deploy your infrastructure.
profile: Your AWS CLI profile to use for deployment.
Each feature/module of your application can be defined as a separate stack file. These live in their own folders and are completely independent.
Example - auth/stack.json
{
"name": "auth",
"functions": {
"verify": "./src/lambda.ts" // AWS Lambda
},
}
Example - rate/stack.json
{
"name": "rate",
"functions": {
"limit": "./src/lambda.ts" // AWS Lambda
},
}
You can create as many stack files as needed, each targeting different parts of your application.
Deploy all stacks
$ pnpm awsless deploy
Deploy individual stack
$ pnpm awsless deploy rate
Deploy multiple stacks
$ pnpm awsless deploy rate auth
Deploy base stack
$ pnpm awsless deploy base
Awsless makes it simple to remove infrastructure when it's no longer needed.
๐งผ Delete a Specific Stack
$ pnpm awsless delete rate
๐ฃ Delete All Stacks
pnpm awsless delete
โ ๏ธ This will remove all deployed resources associated with your stacks. Use with caution!
โป๏ธ Updating or Replacing Resources When you modify a stack file and run a deployment again, Awsless will:
Update existing resources if changes are detected.
Delete resources that are removed from the stack file.
Create new resources as needed.
This ensures your infrastructure always reflects the current state of your stack configuration โ no manual cleanup required.
Once your stacks are defined, Awsless provides built-in helpers like Fn, Queue, and Task to let you interact with your infrastructure directly from your application code โ no wiring or manual setup needed.
To enable full type support for these resources, run:
$ pnpm run dev
This will watch your project and automatically generate type definitions for all the resources you've created.
You can then use them seamlessly inside your Lambda functions:
Now from one lambda function we can all any infra like
import { Queue, Fn } from '@awsless/awsless'
// Call a Lambda function from another stack
await Fn.rate.limit()
// Push a message to a queue
await Queue.notifications.send({ userId: 123 })
๐ก These helpers are fully typed and auto-wired, making your code clean, safe, and easy to maintain.
Awsless supports built-in testing for your stacks to ensure everything works as expected before deployment.
You can define test folder in each stack
{
"name": "rate",
"test": "./path/to/test/folder"
}
exmaple test case
rate/test/utils.ts
describe('test', () => {
it('hello world', async () => {
expect(1 + 2).toStrictEqual(3)
})
})
๐ Run Tests Manually
$ pnpm awsless test rate
This will look for a defined test folder inside the rate stack directory and run any defined tests inside here.
๐ก๏ธ Tests Run Automatically Before Deploy
Whenever you run pnpm awsless deploy, Awsless will automatically:
Check if a test/ folder exists for each stack
Run the tests for that stack
Block the deployment if any tests fail
{
"functions": {
"FUNCTION_NAME": "/path/to/function"
}
}
You can also customize your Lambda function with additional parameters like memory size, timeout, environment variables, and more:
"functions": {
"test": {
"code": "/path/to/function",
"memorySize": 512
}
},
A Task in Awsless is an asynchronous Lambda function designed for background processing. You can trigger a task and immediately move on โ Awsless handles the execution in the background, including retries and logging on failure.
{
"tasks": {
"FUNCTION_NAME": "/path/to/function"
}
}
You can also customize your Lambda function with additional parameters like memory size, timeout, environment variables, and more:
"tasks": {
"test": {
"code": "/path/to/function",
"memorySize": 512
}
},
The tables feature in Awsless allows you to define fully managed, serverless DynamoDB tables directly in your stack configuration.
{
"tables": {
"TABLE_NAME": {
"hash": "id",
"sort": "user",
"indexes": {
"list": {
"hash": "createdAt",
"sort": "id"
}
}
}
}
}
๐ Key Fields:
hash - Primary keysort - Sort keyindexes - Define secondary index hereThis allows you to define a queue along with the consumer lambda.
{
"queues": {
"sendMail": {
"consumer": "/path/to/lambda/file",
"maxConcurrency": 2,
"batchSize": 5
}
}
}
This allows you to define a topic along with the subscriber lambda.
{
{
"topics": [ "TOPIC_NAME" ],
"subscribers": {
"TOPIC_NAME": "topic-consumer.ts",
}
}
}
Awsless uses AWS EventBridge to provide fully managed, serverless cron jobs โ perfect for running scheduled tasks like cleanups, reports, or recurring syncs.
{
"crons": {
"CRON_NAME": {
"schedule": "1 day",
"consumer": "cron-consumer.ts"
}
}
}
๐ Key Options:
schedule: The interval or cron expression to define when the job should run (e.g., "1 day" or "cron(0 12 * _ ? _)").
consumer: Path to the Lambda function that should be triggered on schedule.
Awsless allows you to easily expose any Lambda function as a type-safe RPC (Remote Procedure Call) endpoint for your frontend.
The request and response types are automatically inferred from your Lambda function's payload and return value, giving you end-to-end type safety.
{
"rpc": {
"base": {
// base resource defined in app.json
"SendFriendRequest": "/path/to/lambda"
}
}
}
With awsless, you can interact with your infrastructure directly from your code. awsless generates all necessary types for you, allowing seamless access to your resources.
To set up, define your stacks and run:
$ pnpm awsless dev
This command will generate the required types and mappings, enabling you to access infrastructure components in your code effortlessly.
Resources are accessible via their stack name and resource name. For instance, if a Lambda function exists within a stack named player, you can access its resources using:
player.{resourceName}
Calling a function named limit inside the rate stack:
import { Fn } from '@awsless/awsless'
await Fn.rate.limit({ userId: 'test' })
import { Task } from '@awsless/awsless'
await Task.mail.send({ msg: 'hi', userId: 'test' })
Sending a message to a queue
import { Queue } from '@awsless/awsless'
await Queue.mail.send({ msg: 'hi', userId: 'test' })
Publish a message to SNS topic
import { Topic } from '@awsless/awsless'
await Topic.transaction.credit({ amount: 10, userId: 'test' })
Reading a secret configuration value:
import { Config } from '@awsless/awsless'
const key = await Config.API_KEY
FAQs
Awsless - Infrastructure as a code
We found that @awsless/awsless demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.ย It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.