An open API service indexing awesome lists of open source software.

https://github.com/leonelgalan/cdk-unauthenticated-demo

A `LambdaRestApi` with unauthenticated access.
https://github.com/leonelgalan/cdk-unauthenticated-demo

aws-apigateway aws-identity-pool aws-lambda aws-sdk-js aws-sdk-js-v3 cdk cdk-examples

Last synced: 9 months ago
JSON representation

A `LambdaRestApi` with unauthenticated access.

Awesome Lists containing this project

README

          

## Stack

- An _Identity Pool_ with "Allow unauthenticated identities"
- An _Unauthenticated_ role, to be assumed by unauthenticated identities.
- A `LambdaRestAPI` with a single `ANY` method on root authorized by IAM.
- A _Policy_ that allows _Unauthenticated_ to execute that single endpoint.

## Tooling
- CDK:
- [AWS CDK v2](https://docs.aws.amazon.com/cdk/v2/guide/home.html)
- Client
- [AWS SDK for JavaScript v3](https://github.com/aws/aws-sdk-js-v3):
- `GetIdCommand`
- `GetCredentialsForIdentityCommand`
- [Axios](https://github.com/axios/axios) and [aws4](https://github.com/mhart/aws4)

## Setup

```sh
npm install
cdk bootstrap
npm run deploy
npm run client
```

### Notes

- `npm run deploy` instead of `cdk deploy` to run the `"postdeploy"` script. This will read the outputs and write them into the _.env_ file.
- The **client** is a demo on how to retrieve the identity and credentials to call the API.