> ## Documentation Index
> Fetch the complete documentation index at: https://docs.corsair.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# AWS plugin

> Amazon Web Services: S3, EC2, Lambda, CloudWatch and CloudWatch Logs, IAM, STS, DynamoDB, SQS, SNS, SES, CloudFormation, ECS, ECR, Route 53, Cost Explorer, Secrets Manager, Systems Manager, RDS, CloudFront and KMS (2,649 operations), plus signed calls to any other AWS API.

Use **AWS** through Corsair: one client, typed API calls.

Connect an IAM user's access key: in the AWS console open IAM > Users > your user > Security credentials > Create access key, then enter the access key ID (AKIA…), the secret access key and, if you like, a default region (us-east-1 when left empty). Give the user only the permissions your agent needs; AWS refuses everything else with a 403 that names the missing action. The plugin signs every call with these credentials and never with the machine's own AWS credentials, environment variables or role.

* **Names.** Operations are `<service>.<operation>` with AWS's operation name in lower camel case (`s3.listObjectsV2`, `ec2.describeInstances`, `costExplorer.getCostAndUsage`). Inputs and outputs use AWS's member names exactly (`Bucket`, `MaxKeys`, `InstanceIds`), so the AWS API reference applies as written. A misspelled member is refused with the right name.
* **Region.** Every operation takes `region`; without it a call goes to the connection's default region. IAM, Route 53, CloudFront and Cost Explorer are global and answer from any region.
* **Values.** Timestamps go in as ISO 8601 strings or epoch seconds and come back as ISO 8601 strings. Binary members take a string (sent as UTF-8) or `{ base64 }` and come back as `{ base64 }`, so a value read back (a DynamoDB `LastEvaluatedKey`) goes in again as it is. An S3 upload's `Body` takes a string, `{ text }`, `{ base64 }` or `{ url }`; a download comes back as a file. A Lambda function's answer (`lambda.invoke`) comes back as text.
* **Required members.** AWS's required members are required here; one with a default (Route 53 `EvaluateTargetHealth`) is sent with it when left out. Rules AWS's model doesn't state (exactly one of two members) are left to AWS, which refuses the call with its own message.
* **Paging.** List operations return AWS's own token (`NextToken`, `ContinuationToken`, `Marker`): pass it back to read the next page.
* **Other services.** `call` runs any operation by service and name: JSON APIs (Step Functions, EventBridge, Cognito, Organizations) and Query APIs (Auto Scaling, Elastic Load Balancing, ElastiCache). `request` sends a signed HTTP request to any AWS REST API (Bedrock, API Gateway). Both only go to AWS hosts.
* **Risk.** Deletes, terminations, sends (SES, SNS, SQS), running code (Lambda invoke, SSM commands, ECS tasks), launching paid resources (EC2 instances, RDS databases, NAT gateways), policy and permission changes, and `call` and `request` are `destructive`. With a permission mode such as `cautious` or `strict`, Corsair asks before running them.

**What you get:**

* 2651 typed API operations

## Setup

**1. Install**

```bash npm theme={null}
npm install corsair @corsair-dev/aws better-sqlite3
npm install --save-dev @types/better-sqlite3
```

```bash yarn theme={null}
yarn add corsair @corsair-dev/aws better-sqlite3
yarn add --dev @types/better-sqlite3
```

```bash pnpm theme={null}
pnpm install corsair @corsair-dev/aws better-sqlite3
pnpm install --save-dev @types/better-sqlite3
```

```bash bun theme={null}
bun add corsair @corsair-dev/aws better-sqlite3
bun add --dev @types/better-sqlite3
```

**2. Add the plugin**

```ts corsair.ts theme={null}
import Database from 'better-sqlite3';
import { createCorsair } from 'corsair';
import { aws } from '@corsair-dev/aws';

export const corsair = createCorsair({
	plugins: [
		aws(),
	],
	database: new Database('corsair.db'),
	kek: process.env.CORSAIR_KEK!,
	multiTenancy: true,
	hub: {
		projectApiKey: process.env.CORSAIR_API_KEY!,
		signingSecret: process.env.CORSAIR_SIGNING_SECRET!,
	},
});
```

With `multiTenancy: true`, scope calls with `corsair.withTenant(id)`. See [Quick start](https://docs.corsair.dev/quick-start.md) for KEK + Hub keys, and [Multi-tenancy](https://docs.corsair.dev/concepts/multi-tenancy.md) for account isolation.

**3. Choose authentication**

> [tab] API Key (Recommended)
>
> Store the AWS API key before the first call: `pnpm corsair setup --plugin=aws --tenant=acme api_key=<your-key>` (leave out `--tenant` without `multiTenancy`), or pass it as `key` in the plugin options. With Hub, each tenant enters their own key on the connect page. See [API key auth](https://docs.corsair.dev/concepts/api-key).
>
> AWS needs **two credentials**, stored on the account: the access key ID as `api_key` and the secret access key as `secret_access_key`, plus an optional default `region`. From the CLI: `pnpm corsair setup --plugin=aws api_key=AKIA… secret_access_key=… region=us-east-1`. Without a store, pass `credentials: { accessKeyId, secretAccessKey, sessionToken? }` and `region` to `aws()`.
>
> ```ts theme={null}
> aws()
> ```
>
> More: [API Key](https://docs.corsair.dev/concepts/api-key)

**4. Connect a tenant**

Mint a connect link and send the tenant to it. Hub hosts the page and delivers the result to your app — see [Connect / OAuth](https://docs.corsair.dev/management/connect).

```ts theme={null}
const { connectUrl } = await corsair.manage.connect.createLink({
	plugin: 'aws',
	tenantId: 'acme',
});
// redirect the user's browser to connectUrl
```

## Example API calls

**List the objects in a bucket**

```ts theme={null}
const tenant = corsair.withTenant('acme');
await tenant.aws.api.s3.listObjectsV2({ Bucket: 'my-bucket', Prefix: 'reports/', MaxKeys: 50 });
```

**Upload a text file to S3**

```ts theme={null}
const tenant = corsair.withTenant('acme');
await tenant.aws.api.s3.putObject({
	Bucket: 'my-bucket',
	Key: 'notes/hello.txt',
	Body: { text: 'hello', contentType: 'text/plain' },
});
```

See the full list on the [API](https://docs.corsair.dev/plugins/aws/api.md) page.

## What's next

> [card] [API reference](https://docs.corsair.dev/plugins/aws/api.md)
>
> Every `aws.api.*` operation with input and output types.

> [card] [Connect / OAuth](https://docs.corsair.dev/management/connect)
>
> createLink, Hub delivery, and tenant connect flows.

> [card] [Use with agents](https://docs.corsair.dev/mcp-adapters/mcp-adapters)
>
> Expose this plugin's operations as MCP tools.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.