{"id":19243760,"url":"https://github.com/lukaszbudnik/aws-cdk-items-app","last_synced_at":"2025-08-22T22:24:00.547Z","repository":{"id":145990259,"uuid":"382468778","full_name":"lukaszbudnik/aws-cdk-items-app","owner":"lukaszbudnik","description":"API Gateway HTTP API with JWT Authorizer and Lambda and DynamoDB integration.","archived":false,"fork":false,"pushed_at":"2021-07-16T11:28:19.000Z","size":211,"stargazers_count":6,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-21T09:52:11.981Z","etag":null,"topics":["aws","cdk-examples","jwt","jwt-authentication"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lukaszbudnik.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-07-02T21:32:07.000Z","updated_at":"2024-04-20T13:04:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"5ec35175-9a96-4257-a89e-057e7028ca0b","html_url":"https://github.com/lukaszbudnik/aws-cdk-items-app","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/lukaszbudnik/aws-cdk-items-app","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukaszbudnik%2Faws-cdk-items-app","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukaszbudnik%2Faws-cdk-items-app/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukaszbudnik%2Faws-cdk-items-app/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukaszbudnik%2Faws-cdk-items-app/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lukaszbudnik","download_url":"https://codeload.github.com/lukaszbudnik/aws-cdk-items-app/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukaszbudnik%2Faws-cdk-items-app/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271710540,"owners_count":24807684,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-22T02:00:08.480Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","cdk-examples","jwt","jwt-authentication"],"created_at":"2024-11-09T17:19:36.272Z","updated_at":"2025-08-22T22:24:00.521Z","avatar_url":"https://github.com/lukaszbudnik.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"#  aws-cdk-items-app\n\nThis is a sample TypeScript CDK app to show how to set up AWS API Gateway JWT Authorizers using Keycloak as an OIDC provider.\n\nThe sample app comprises of the following components:\n\n* DynamoDB table `items`\n* Lambda function `create-item` - creates an item in DynamoDB table, parses JWT token from the request and uses email claim as a PK attribute (SK attribute is uuid)\n* Lambda function `get-items` - gets items from DynamoDB table, performs scan operation on the table\n* API Gateway v2 HTTP service with JWT authorizer\n  * `GET /items` - invokes `get-items` lambda, publically available\n  * `POST /items` - invokes `create-items` lambda, available to authorized users only\n\n# Setup\n\nMake sure you have cdk installed and cdk has access to typescript and all nodejs packages are available:\n\n```bash\n# global setup\nnpm install -g cdk\nnpm install -g typescript\n# project-specific setup\ngit clone git@github.com:lukaszbudnik/aws-cdk-items-app.git\ncd aws-cdk-items-app\nnpm link typescript\nnpm install\n# check if cdk can synthesize the stacks\ncdk synth\n# build create-item lambda - nothing special, but uses uuid to generate unique SK in DynamoDB\ncd lib/lambda/create-item\nnpm install\n```\n\n# Deploy\n\nThe cdk will deploy two stacks in your AWS account: `Database` and `Service`. cdk will take care of provisioning everything, including IAM policies.\n\nIn order to deploy JWT Authorizer the following two parameters are required and have to be valid: `Service:jwtIssuer` and `Service:jwtAudience`. \n\nThe JWT Authorizer is validated during the deploy and the deployment will fail if any of the parameters is missing or is invalid. If you don't have OIDC provider at hand, don't worry, I got you covered. See my video which shows how super easy it is to deploy Keycloak cluster to AWS EKS: https://youtu.be/BuNZ7bjbzOQ.\n\nOnce you have Keycloak (or any other OIDC provider), pass the issuer URL and audience parameters to the cdk deploy command:\n\n```bash\ncdk bootstrap\ncdk deploy --all \\\n  --parameters Service:jwtIssuer=https://example.com/auth/realms/customer123 \\\n  --parameters Service:jwtAudience=account\n```\n\n## Useful commands\n\nThe `cdk.json` file tells the CDK Toolkit how to execute your app.\n\n * `npm run build`   compile typescript to js\n * `npm run watch`   watch for changes and compile\n * `npm run test`    perform the jest unit tests\n * `cdk deploy`      deploy this stack to your default AWS account/region\n * `cdk diff`        compare deployed stack with current state\n * `cdk synth`       emits the synthesized CloudFormation template\n * `cdk destroy`     destroys this stack from your default AWS account/region\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukaszbudnik%2Faws-cdk-items-app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flukaszbudnik%2Faws-cdk-items-app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukaszbudnik%2Faws-cdk-items-app/lists"}