From 1184a37b61b34a50ae679a1d9798bda599684acc Mon Sep 17 00:00:00 2001 From: Waldemar Hummer Date: Sat, 18 Apr 2026 17:56:34 +0200 Subject: [PATCH 01/12] Clean up leftover old workshop folders; update README with Mermaid diagram - Remove 00-hello-world, 01-serverless-image-resizer, 02-serverless-api-ecs-apigateway, 03-appsync-graphql-api-cdk, 04-cloud-pods-persistence, LICENSE (old EuroPython leftovers) - README: add Mermaid architecture diagram, Makefile targets section, updated module table and repo layout reflecting current state Co-Authored-By: Claude Sonnet 4.6 --- 00-hello-world/README.md | 15 - 00-hello-world/bucket-policy.json | 12 - 00-hello-world/deploy.sh | 13 - 00-hello-world/index.html | 27 - 00-hello-world/list_s3_objects.py | 29 - 01-serverless-image-resizer/.gitignore | 62 - .../CODE_OF_CONDUCT.md | 128 - 01-serverless-image-resizer/CONTRIBUTING.md | 54 - 01-serverless-image-resizer/LICENSE | 201 - 01-serverless-image-resizer/README.md | 262 - 01-serverless-image-resizer/bin/deploy.sh | 129 - .../lambdas/list/handler.py | 76 - .../lambdas/presign/handler.py | 49 - .../lambdas/resize/handler.py | 61 - .../lambdas/resize/requirements.txt | 1 - .../requirements-dev.txt | 11 - .../tests/nyan-cat.png | Bin 15044 -> 0 bytes .../tests/some-file.txt | 2 - .../tests/test_integration.py | 87 - 01-serverless-image-resizer/website/app.js | 167 - .../website/favicon.ico | Bin 15086 -> 0 bytes .../website/index.html | 151 - 02-serverless-api-ecs-apigateway/.gitignore | 323 - 02-serverless-api-ecs-apigateway/LICENSE | 201 - 02-serverless-api-ecs-apigateway/Makefile | 55 - 02-serverless-api-ecs-apigateway/README.md | 299 - .../client-application-react/.gitignore | 40 - .../amplify/backend/backend-config.json | 1 - .../amplify/team-provider-info.json | 15 - .../client-application-react/package.json | 38 - .../public/favicon.ico | Bin 3150 -> 0 bytes .../public/index.html | 43 - .../public/logo192.png | Bin 5347 -> 0 bytes .../public/logo512.png | Bin 9664 -> 0 bytes .../public/manifest.json | 25 - .../public/robots.txt | 3 - .../client-application-react/src/App.css | 38 - .../client-application-react/src/App.js | 212 - .../client-application-react/src/App.test.js | 9 - .../client-application-react/src/index.css | 13 - .../client-application-react/src/index.js | 20 - .../client-application-react/src/logo.svg | 7 - .../src/serviceWorker.js | 141 - .../src/setupTests.js | 5 - .../client-application-react/yarn.lock | 14145 ---------------- .../cloud-pods-seed-tests/bootstrap | Bin 117093 -> 0 bytes .../cloud-pods-seed-tests/food.json | 13 - .../cloud-pods-seed-tests/pet.json | 13 - .../cloud-pods-seed-tests/table.sh | 24 - .../cloudformation/deploy.sh | 15 - .../ecsapi-demo-cloudformation.yaml | 754 - .../ecsapi-demo-foodstore/.dockerignore | 2 - .../ecsapi-demo-foodstore/.gitignore | 2 - .../ecsapi-demo-foodstore/Dockerfile | 54 - .../ecsapi-demo-foodstore/Dockerfile.patch | 3 - .../ecsapi-demo-foodstore/package.json | 14 - .../ecsapi-demo-foodstore/server.js | 70 - .../ecsapi-demo-foodstore/yarn.lock | 586 - .../ecsapi-demo-petstore/.dockerignore | 2 - .../ecsapi-demo-petstore/.gitignore | 2 - .../ecsapi-demo-petstore/Dockerfile | 54 - .../ecsapi-demo-petstore/Dockerfile.patch | 3 - .../ecsapi-demo-petstore/package.json | 14 - .../ecsapi-demo-petstore/server.js | 70 - .../ecsapi-demo-petstore/yarn.lock | 586 - .../images/interface.png | Bin 58352 -> 0 bytes .../images/serverless-container-api.png | Bin 333000 -> 0 bytes .../images/web-app-items.png | Bin 76912 -> 0 bytes .../images/web-app-tables.png | Bin 58160 -> 0 bytes .../resources/resources.txt | 34 - .../terraform/main.tf | 817 - .../tests/requirements.txt | 13 - .../tests/test_app.py | 17 - 03-appsync-graphql-api-cdk/.gitignore | 22 - 03-appsync-graphql-api-cdk/LICENSE | 201 - 03-appsync-graphql-api-cdk/Makefile | 48 - 03-appsync-graphql-api-cdk/README.md | 158 - 03-appsync-graphql-api-cdk/cdk/.gitignore | 10 - 03-appsync-graphql-api-cdk/cdk/app.py | 28 - 03-appsync-graphql-api-cdk/cdk/cdk.json | 52 - .../cdk/lib/__init__.py | 0 .../cdk/lib/cdk_stack.py | 118 - .../appsync-datasource-architecture.png | Bin 508217 -> 0 bytes 03-appsync-graphql-api-cdk/requirements.txt | 7 - 03-appsync-graphql-api-cdk/run.sh | 28 - 03-appsync-graphql-api-cdk/schema.graphql | 25 - .../templates/ddb.PutItem.request.vlt | 8 - .../templates/ddb.PutItem.response.vlt | 1 - .../templates/ddb.Scan.request.vlt | 4 - .../templates/ddb.Scan.response.vlt | 1 - .../templates/rds.insert.request.vlt | 8 - .../templates/rds.insert.response.vlt | 3 - .../templates/rds.select.request.vlt | 6 - .../templates/rds.select.response.vlt | 2 - .../websocket_client.py | 45 - 04-cloud-pods-persistence/README.md | 50 - LICENSE | 201 - README.md | 84 +- 98 files changed, 58 insertions(+), 21384 deletions(-) delete mode 100644 00-hello-world/README.md delete mode 100644 00-hello-world/bucket-policy.json delete mode 100755 00-hello-world/deploy.sh delete mode 100644 00-hello-world/index.html delete mode 100644 00-hello-world/list_s3_objects.py delete mode 100644 01-serverless-image-resizer/.gitignore delete mode 100644 01-serverless-image-resizer/CODE_OF_CONDUCT.md delete mode 100644 01-serverless-image-resizer/CONTRIBUTING.md delete mode 100644 01-serverless-image-resizer/LICENSE delete mode 100644 01-serverless-image-resizer/README.md delete mode 100755 01-serverless-image-resizer/bin/deploy.sh delete mode 100644 01-serverless-image-resizer/lambdas/list/handler.py delete mode 100644 01-serverless-image-resizer/lambdas/presign/handler.py delete mode 100644 01-serverless-image-resizer/lambdas/resize/handler.py delete mode 100644 01-serverless-image-resizer/lambdas/resize/requirements.txt delete mode 100644 01-serverless-image-resizer/requirements-dev.txt delete mode 100644 01-serverless-image-resizer/tests/nyan-cat.png delete mode 100644 01-serverless-image-resizer/tests/some-file.txt delete mode 100644 01-serverless-image-resizer/tests/test_integration.py delete mode 100644 01-serverless-image-resizer/website/app.js delete mode 100644 01-serverless-image-resizer/website/favicon.ico delete mode 100644 01-serverless-image-resizer/website/index.html delete mode 100644 02-serverless-api-ecs-apigateway/.gitignore delete mode 100644 02-serverless-api-ecs-apigateway/LICENSE delete mode 100644 02-serverless-api-ecs-apigateway/Makefile delete mode 100644 02-serverless-api-ecs-apigateway/README.md delete mode 100644 02-serverless-api-ecs-apigateway/client-application-react/.gitignore delete mode 100644 02-serverless-api-ecs-apigateway/client-application-react/amplify/backend/backend-config.json delete mode 100644 02-serverless-api-ecs-apigateway/client-application-react/amplify/team-provider-info.json delete mode 100644 02-serverless-api-ecs-apigateway/client-application-react/package.json delete mode 100644 02-serverless-api-ecs-apigateway/client-application-react/public/favicon.ico delete mode 100644 02-serverless-api-ecs-apigateway/client-application-react/public/index.html delete mode 100644 02-serverless-api-ecs-apigateway/client-application-react/public/logo192.png delete mode 100644 02-serverless-api-ecs-apigateway/client-application-react/public/logo512.png delete mode 100644 02-serverless-api-ecs-apigateway/client-application-react/public/manifest.json delete mode 100644 02-serverless-api-ecs-apigateway/client-application-react/public/robots.txt delete mode 100644 02-serverless-api-ecs-apigateway/client-application-react/src/App.css delete mode 100644 02-serverless-api-ecs-apigateway/client-application-react/src/App.js delete mode 100644 02-serverless-api-ecs-apigateway/client-application-react/src/App.test.js delete mode 100644 02-serverless-api-ecs-apigateway/client-application-react/src/index.css delete mode 100644 02-serverless-api-ecs-apigateway/client-application-react/src/index.js delete mode 100644 02-serverless-api-ecs-apigateway/client-application-react/src/logo.svg delete mode 100644 02-serverless-api-ecs-apigateway/client-application-react/src/serviceWorker.js delete mode 100644 02-serverless-api-ecs-apigateway/client-application-react/src/setupTests.js delete mode 100644 02-serverless-api-ecs-apigateway/client-application-react/yarn.lock delete mode 100644 02-serverless-api-ecs-apigateway/cloud-pods-seed-tests/bootstrap delete mode 100644 02-serverless-api-ecs-apigateway/cloud-pods-seed-tests/food.json delete mode 100644 02-serverless-api-ecs-apigateway/cloud-pods-seed-tests/pet.json delete mode 100755 02-serverless-api-ecs-apigateway/cloud-pods-seed-tests/table.sh delete mode 100755 02-serverless-api-ecs-apigateway/cloudformation/deploy.sh delete mode 100644 02-serverless-api-ecs-apigateway/cloudformation/ecsapi-demo-cloudformation.yaml delete mode 100644 02-serverless-api-ecs-apigateway/containers-nodejs/ecsapi-demo-foodstore/.dockerignore delete mode 100644 02-serverless-api-ecs-apigateway/containers-nodejs/ecsapi-demo-foodstore/.gitignore delete mode 100644 02-serverless-api-ecs-apigateway/containers-nodejs/ecsapi-demo-foodstore/Dockerfile delete mode 100644 02-serverless-api-ecs-apigateway/containers-nodejs/ecsapi-demo-foodstore/Dockerfile.patch delete mode 100644 02-serverless-api-ecs-apigateway/containers-nodejs/ecsapi-demo-foodstore/package.json delete mode 100644 02-serverless-api-ecs-apigateway/containers-nodejs/ecsapi-demo-foodstore/server.js delete mode 100644 02-serverless-api-ecs-apigateway/containers-nodejs/ecsapi-demo-foodstore/yarn.lock delete mode 100644 02-serverless-api-ecs-apigateway/containers-nodejs/ecsapi-demo-petstore/.dockerignore delete mode 100644 02-serverless-api-ecs-apigateway/containers-nodejs/ecsapi-demo-petstore/.gitignore delete mode 100644 02-serverless-api-ecs-apigateway/containers-nodejs/ecsapi-demo-petstore/Dockerfile delete mode 100644 02-serverless-api-ecs-apigateway/containers-nodejs/ecsapi-demo-petstore/Dockerfile.patch delete mode 100644 02-serverless-api-ecs-apigateway/containers-nodejs/ecsapi-demo-petstore/package.json delete mode 100644 02-serverless-api-ecs-apigateway/containers-nodejs/ecsapi-demo-petstore/server.js delete mode 100644 02-serverless-api-ecs-apigateway/containers-nodejs/ecsapi-demo-petstore/yarn.lock delete mode 100644 02-serverless-api-ecs-apigateway/images/interface.png delete mode 100644 02-serverless-api-ecs-apigateway/images/serverless-container-api.png delete mode 100644 02-serverless-api-ecs-apigateway/images/web-app-items.png delete mode 100644 02-serverless-api-ecs-apigateway/images/web-app-tables.png delete mode 100644 02-serverless-api-ecs-apigateway/resources/resources.txt delete mode 100644 02-serverless-api-ecs-apigateway/terraform/main.tf delete mode 100644 02-serverless-api-ecs-apigateway/tests/requirements.txt delete mode 100644 02-serverless-api-ecs-apigateway/tests/test_app.py delete mode 100644 03-appsync-graphql-api-cdk/.gitignore delete mode 100644 03-appsync-graphql-api-cdk/LICENSE delete mode 100644 03-appsync-graphql-api-cdk/Makefile delete mode 100644 03-appsync-graphql-api-cdk/README.md delete mode 100644 03-appsync-graphql-api-cdk/cdk/.gitignore delete mode 100644 03-appsync-graphql-api-cdk/cdk/app.py delete mode 100644 03-appsync-graphql-api-cdk/cdk/cdk.json delete mode 100644 03-appsync-graphql-api-cdk/cdk/lib/__init__.py delete mode 100644 03-appsync-graphql-api-cdk/cdk/lib/cdk_stack.py delete mode 100644 03-appsync-graphql-api-cdk/images/appsync-datasource-architecture.png delete mode 100644 03-appsync-graphql-api-cdk/requirements.txt delete mode 100755 03-appsync-graphql-api-cdk/run.sh delete mode 100644 03-appsync-graphql-api-cdk/schema.graphql delete mode 100644 03-appsync-graphql-api-cdk/templates/ddb.PutItem.request.vlt delete mode 100644 03-appsync-graphql-api-cdk/templates/ddb.PutItem.response.vlt delete mode 100644 03-appsync-graphql-api-cdk/templates/ddb.Scan.request.vlt delete mode 100644 03-appsync-graphql-api-cdk/templates/ddb.Scan.response.vlt delete mode 100644 03-appsync-graphql-api-cdk/templates/rds.insert.request.vlt delete mode 100644 03-appsync-graphql-api-cdk/templates/rds.insert.response.vlt delete mode 100644 03-appsync-graphql-api-cdk/templates/rds.select.request.vlt delete mode 100644 03-appsync-graphql-api-cdk/templates/rds.select.response.vlt delete mode 100644 03-appsync-graphql-api-cdk/websocket_client.py delete mode 100644 04-cloud-pods-persistence/README.md delete mode 100644 LICENSE diff --git a/00-hello-world/README.md b/00-hello-world/README.md deleted file mode 100644 index b09437e..0000000 --- a/00-hello-world/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# Hello World in LocalStack - -This simple serverless app is the Hello World of LocalStack. -It will deploy an S3 static website with a simple _"Hello World"_ message. - -For more information, visit our [docs](https://docs.localstack.cloud/tutorials/s3-static-website-terraform/). - -## How to run - -Simply start LocalStack with `localstack start -d` and then run the `deploy.sh` script. - -Once deployed, you can open the page in the browser: http://testwebsite.s3-website.localhost.localstack.cloud:4566 - -**Note**: If you are executing in Github Codespaces, you can right-click on port 4566, then "Copy Local Address", and then append the suffix /testwebsite/index.html to the URL. -For example, the final URL may look something like this: https://yourusername-vigilant-umbrella-q94554wwv-4566.preview.app.github.dev/testwebsite/index.html diff --git a/00-hello-world/bucket-policy.json b/00-hello-world/bucket-policy.json deleted file mode 100644 index db6bd52..0000000 --- a/00-hello-world/bucket-policy.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "Version": "2012-10-17", - "Statement": [ - { - "Sid": "PublicReadGetObject", - "Effect": "Allow", - "Principal": "*", - "Action": "s3:GetObject", - "Resource": "arn:aws:s3:::aws-day/*" - } - ] -} diff --git a/00-hello-world/deploy.sh b/00-hello-world/deploy.sh deleted file mode 100755 index 21339f3..0000000 --- a/00-hello-world/deploy.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -awslocal s3api create-bucket --bucket testwebsite - -awslocal s3api put-bucket-policy --bucket testwebsite --policy file://bucket-policy.json - -awslocal s3 sync ./ s3://testwebsite - -awslocal s3 website s3://testwebsite/ --index-document index.html - -echo "Visit http://testwebsite.s3-website.localhost.localstack.cloud:4566/" -echo -echo "If you're using Github Codespaces, find the public endpoint for port 4566, then visit https://-4566.preview.app.github.dev/testwebsite/index.html" diff --git a/00-hello-world/index.html b/00-hello-world/index.html deleted file mode 100644 index a78aa79..0000000 --- a/00-hello-world/index.html +++ /dev/null @@ -1,27 +0,0 @@ - - - - LocalStack S3 website - - - - -

You are running LocalStack 🎉

-

- Welcome to the EuroPython 2023 LocalStack workshop! -

-

- You are viewing an HTML document in the S3 bucket called testwebsite. - The S3 feature website configuration allows you to serve static websites directly through an S3 bucket URL. -

-

- As you can see, LocalStack fully emulates this behavior! -

- - diff --git a/00-hello-world/list_s3_objects.py b/00-hello-world/list_s3_objects.py deleted file mode 100644 index 7d8e8be..0000000 --- a/00-hello-world/list_s3_objects.py +++ /dev/null @@ -1,29 +0,0 @@ -# This is a simple Python script to illustrate the use of boto3, the AWS SDK -# for Python. We use a boto3 client below to list all S3 buckets and objects. -import os - -import boto3 - -LOCALSTACK_ENDPOINT = "http://localhost:4566" -AWS_REGION = os.environ.get("AWS_DEFAULT_REGION", "us-east-1") - - -def main(): - client = boto3.client( - "s3", - endpoint_url=LOCALSTACK_ENDPOINT, - aws_access_key_id="test", - aws_secret_access_key="test", - region_name=AWS_REGION - ) - - buckets = client.list_buckets()["Buckets"] - for bucket in buckets: - print(f"Found bucket: {bucket['Name']}") - objects = client.list_objects(Bucket=bucket["Name"]).get("Contents", []) - for obj in objects: - print(f"Found object: s3://{bucket['Name']}/{obj['Key']}") - - -if __name__ == "__main__": - main() diff --git a/01-serverless-image-resizer/.gitignore b/01-serverless-image-resizer/.gitignore deleted file mode 100644 index e27f06c..0000000 --- a/01-serverless-image-resizer/.gitignore +++ /dev/null @@ -1,62 +0,0 @@ -*.pyc -*.pyo -*.class -*.log -*.iml -.coverage.* -htmlcov - -/node_modules/ -package-lock.json -/nosetests.xml - -.env -venv -/.venv* -/.coverage -.settings/ -.project -.classpath -.DS_Store -*.egg-info/ -.eggs/ -.vagrant/ -*.sw* -~* -*~ - -node_modules/ -/build/ -/dist/ -/target/ - -.idea -.vscode - -**/obj/** -**/lib/** -**/libs/** - -!bin/docker-entrypoint.sh - -requirements.copy.txt -.serverless/ - -**/.terraform/* -*.tfstate -*.tfstate.* -*tfplan -*.terraform.lock.hcl - -.python-version - -venv -api_states - -tmp/ - -volume/ - -# lambda packages -lambdas/*/package/ -lambdas/*/lambda.zip diff --git a/01-serverless-image-resizer/CODE_OF_CONDUCT.md b/01-serverless-image-resizer/CODE_OF_CONDUCT.md deleted file mode 100644 index e7a16ee..0000000 --- a/01-serverless-image-resizer/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,128 +0,0 @@ -# Contributor Covenant Code of Conduct - -## Our Pledge - -We, as members, contributors, and leaders, pledge to make participation in our -community a harassment-free experience for everyone, regardless of age, body -size, visible or invisible disability, ethnicity, sex characteristics, gender -identity and expression, level of experience, education, socio-economic status, -nationality, personal appearance, race, religion, or sexual identity -and orientation. - -We pledge to act and interact in ways that contribute to an open, welcoming, -diverse, inclusive, and healthy community. - -## Our Standards - -Examples of behavior that contributes to a positive environment for our -community include: - -* Demonstrating empathy and kindness toward other people -* Being respectful of differing opinions, viewpoints, and experiences -* Giving and gracefully accepting constructive feedback -* Accepting responsibility and apologizing to those affected by our mistakes, - and learning from the experience -* Focusing on what is best not just for us as individuals but for the - overall community - -Examples of unacceptable behavior include: - -* The use of sexualized language or imagery and sexual attention or - advances of any kind -* Trolling, insulting or derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or email - address without their explicit permission -* Other conduct which could reasonably be considered inappropriate in a - professional setting - -## Enforcement Responsibilities - -Community leaders are responsible for clarifying and enforcing our standards of -acceptable behavior and will take appropriate and fair corrective action in -response to any behavior that they deem inappropriate, threatening, offensive, -or harmful. - -Community leaders have the right and responsibility to remove, edit, or reject -comments, commits, code, wiki edits, issues, and other contributions that are -not aligned to this Code of Conduct, and will communicate reasons for moderation -decisions when appropriate. - -## Scope - -This Code of Conduct applies within all community spaces and also applies when -an individual is officially representing the community in public spaces. -Examples of representing our community include using an official e-mail address, -posting via an official social media account or acting as an appointed -representative at an online or offline event. - -## Enforcement - -Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported to the community leaders responsible for enforcement at -info@localstack.cloud. -All complaints will be reviewed and investigated promptly and fairly. - -All community leaders are obligated to respect the privacy and security of the -reporter of any incident. - -## Enforcement Guidelines - -Community leaders will follow these Community Impact Guidelines in determining -the consequences for any action they deem in violation of this Code of Conduct: - -### 1. Correction - -**Community Impact**: Use of inappropriate language or other behavior deemed -unprofessional or unwelcome in the community. - -**Consequence**: A private, written warning from community leaders, providing -clarity around the nature of the violation and an explanation of why the -behavior was inappropriate. A public apology may be requested. - -### 2. Warning - -**Community Impact**: A violation through a single incident or series -of actions. - -**Consequence**: A warning with consequences for continued behavior. No -interaction with the people involved, including unsolicited interaction with -those enforcing the Code of Conduct, for a specified period of time. This -includes avoiding interactions in community spaces as well as external channels -like social media. Violating these terms may lead to a temporary or -permanent ban. - -### 3. Temporary Ban - -**Community Impact**: A serious violation of community standards, including -sustained inappropriate behavior. - -**Consequence**: A temporary ban from any interaction or public -communication with the community for a specified period of time. No public or -private interaction with the people involved, including unsolicited interaction -with those enforcing the Code of Conduct, is allowed during this period. -Violating these terms may lead to a permanent ban. - -### 4. Permanent Ban - -**Community Impact**: Demonstrating a pattern of violation of community -standards, including sustained inappropriate behavior, harassment of an -individual, or aggression toward or disparagement of classes of individuals. - -**Consequence**: A permanent ban from any public interaction within -the community. - -## Attribution - -This Code of Conduct is adapted from the [Contributor Covenant][homepage], -version 2.0, available at -https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. - -Community Impact Guidelines were inspired by [Mozilla's code of conduct -enforcement ladder](https://github.com/mozilla/diversity). - -[homepage]: https://www.contributor-covenant.org - -For answers to common questions about this code of conduct, see the FAQ at -https://www.contributor-covenant.org/faq. Translations are available at -https://www.contributor-covenant.org/translations. diff --git a/01-serverless-image-resizer/CONTRIBUTING.md b/01-serverless-image-resizer/CONTRIBUTING.md deleted file mode 100644 index 10dc801..0000000 --- a/01-serverless-image-resizer/CONTRIBUTING.md +++ /dev/null @@ -1,54 +0,0 @@ -# Contributing Guidelines - -Thank you for your interest in contributing to our project. Whether it's a bug report, new feature, correction, or additional -documentation, we greatly value feedback and contributions from our community. - -Please read through this document before submitting any issues or pull requests to ensure we have all the necessary -information to effectively respond to your bug report or contribution. - - -## Reporting Bugs/Feature Requests - -We welcome you to use the GitHub issue tracker to report bugs or suggest features. - -When filing an issue, please check existing open or recently closed issues to make sure somebody else hasn't already -reported the issue. Please try to include as much information as you can. Details like these are incredibly useful: - -* A reproducible test case or series of steps -* The version of our code being used -* Any modifications you've made relevant to the bug -* Anything unusual about your environment or deployment - - -## Contributing via Pull Requests -Contributions via pull requests are much appreciated. Before sending us a pull request, please ensure the following: - -1. You are working against the latest source on the *main* branch. -2. You check existing open and recently merged pull requests to make sure someone else hasn't addressed the problem already. -3. You open an issue to discuss any significant work - we would hate to waste your time. - -To send us a pull request, please: - -1. Fork the repository. -2. Modify the source; please focus on the specific change you are contributing. If you also reformat all the code, it will be hard for us to focus on your change. -3. Ensure local tests pass. -4. Commit to your fork using clear commit messages. -5. Send us a pull request, answering any default questions in the pull request interface. -6. Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation. - -GitHub provides additional documents on [forking a repository](https://help.github.com/articles/fork-a-repo/) and -[creating a pull request](https://help.github.com/articles/creating-a-pull-request/). - - -## Finding contributions to work on -Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels (enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any 'help wanted' issues is a great place to start. - - -## Code of Conduct -Please review the adopted [code of conduct](CODE_OF_CONDUCT.md) and make sure you follow the guidelines. - - -## Licensing - -See the [LICENSE](LICENSE) file for our project's licensing. By contributing, you agree that your contributions will be licensed under the existing license. - diff --git a/01-serverless-image-resizer/LICENSE b/01-serverless-image-resizer/LICENSE deleted file mode 100644 index 061fa11..0000000 --- a/01-serverless-image-resizer/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2023 LocalStack GmbH - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/01-serverless-image-resizer/README.md b/01-serverless-image-resizer/README.md deleted file mode 100644 index 91a8b87..0000000 --- a/01-serverless-image-resizer/README.md +++ /dev/null @@ -1,262 +0,0 @@ -# Serverless image resizer - -[![LocalStack Pods Launchpad](https://localstack.cloud/gh/launch-pod-badge.svg)](https://app.localstack.cloud/launchpad?url=https://github.com/localstack/sample-serverless-image-resizer-s3-lambda/releases/download/latest/release-pod.zip) - -| Key | Value | -|--------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| Environment | | -| Services | S3, SSM, Lambda, SNS, SES | -| Integrations | AWS SDK, AWS CLI, GitHub actions, pytest | -| Categories | Serverless, S3 notifications, S3 website, Lambda function URLs, LocalStack developer endpoints, JavaScript, Python | | -| Level | Intermediate | - -## Introduction - -This is an app to resize images uploaded to S3 in a serverless way. -A simple web fronted using HTML and JavaScript provides a way for users to upload images that are resized and listed. -We use a Lambda to generate S3 pre-signed URLs so the upload form can upload directly to S3 rather than going through the Lambda. -S3 bucket notifications are used to trigger a Python Lambda that runs image resizing. -Another Lambda is used to list all uploaded and resized images, and provide pre-signed URLs for the browser to display them. -We also demonstrate how Lambda failures can submit to SNS, which can then trigger an SES email. -Using the LocalStack internal `/_localstack/aws/ses` endpoint, we can run end-to-end integration tests to verify that emails have been sent correctly. - -Here's a short summary of AWS service features we use: -* S3 bucket notifications to trigger a Lambda -* S3 pre-signed POST -* S3 website -* Lambda function URLs -* Lambda SNS on failure destination -* SNS to SES Subscriptions -* SES LocalStack testing endpoint - -Here's the web application in action: - -https://user-images.githubusercontent.com/3996682/229314248-86122e9e-0150-4292-b889-401e6fb8f398.mp4 - -Moreover, the repo includes a GitHub actions workflow to demonstrate how to run end-to-end tests of your AWS apps using LocalStack in CI. -The GitHub workflow runs a set of integration tests using pytest. - -## Architecture overview - -![Screenshot at 2023-04-02 01-32-56](https://user-images.githubusercontent.com/3996682/229322761-92f52eec-5bfb-412a-a3cb-8af4ee1fed24.png) - -## Prerequisites - -### Dev environment - -Make sure you use the same version as the Python Lambdas to make Pillow work. -If you use pyenv, then first install and activate Python 3.9: - -```bash -pyenv install 3.9.16 -pyenv global 3.9.16 -``` - -```console -% python --version -Python 3.9.16 -``` - -Create a virtualenv and install all the development dependencies there: - -```bash -python -m venv .venv -source .venv/bin/activate -pip install -r requirements-dev.txt -``` - -### LocalStack - -Start LocalStack Pro with the appropriate CORS configuration for the S3 Website: - -```bash -LOCALSTACK_AUTH_TOKEN=... localstack start -``` - -## Instructions - -You can create the AWS infrastructure on LocalStack by running `bin/deploy.sh`. -Make sure you have Python 3.9 activated before running the script. - -Here are instructions to deploy it manually step-by-step. - -### Create the buckets - -The names are completely configurable via SSM: - -```bash -awslocal s3 mb s3://localstack-thumbnails-app-images -awslocal s3 mb s3://localstack-thumbnails-app-resized -``` - -### Put the bucket names into the parameter store - -```bash -awslocal ssm put-parameter --name /localstack-thumbnail-app/buckets/images --type "String" --value "localstack-thumbnails-app-images" -awslocal ssm put-parameter --name /localstack-thumbnail-app/buckets/resized --type "String" --value "localstack-thumbnails-app-resized" -``` - -### Create the DLQ Topic for failed lambda invokes - -```bash -awslocal sns create-topic --name failed-resize-topic -``` - -Subscribe an email address to it (to alert us immediately if an image resize fails!). - -```bash -awslocal sns subscribe \ - --topic-arn arn:aws:sns:us-east-1:000000000000:failed-resize-topic \ - --protocol email \ - --notification-endpoint my-email@example.com -``` - -### Create the lambdas - -#### S3 pre-signed POST URL generator - -This Lambda is responsible for generating pre-signed POST URLs to upload files to an S3 bucket. - -```bash -(cd lambdas/presign; rm -f lambda.zip; zip lambda.zip handler.py) -awslocal lambda create-function \ - --function-name presign \ - --runtime python3.9 \ - --timeout 10 \ - --zip-file fileb://lambdas/presign/lambda.zip \ - --handler handler.handler \ - --role arn:aws:iam::000000000000:role/lambda-role -``` - -Create the function URL: - -```bash -awslocal lambda create-function-url-config \ - --function-name presign \ - --auth-type NONE -``` - -Copy the `FunctionUrl` from the response, you will need it later to make the app work. - -### Image lister lambda - -The `list` Lambda is very similar: - -```bash -(cd lambdas/list; rm -f lambda.zip; zip lambda.zip handler.py) -awslocal lambda create-function \ - --function-name list \ - --handler handler.handler \ - --zip-file fileb://lambdas/list/lambda.zip \ - --runtime python3.9 \ - --role arn:aws:iam::000000000000:role/lambda-role -``` - -Create the function URL: - -```bash -awslocal lambda create-function-url-config \ - --function-name list \ - --auth-type NONE -``` - -### Resizer Lambda - -```bash -( - cd lambdas/resize - rm -rf package lambda.zip - mkdir package - pip install -r requirements.txt -t package - zip lambda.zip handler.py - cd package - zip -r ../lambda.zip *; -) -awslocal lambda create-function \ - --function-name resize \ - --runtime python3.9 \ - --timeout 10 \ - --zip-file fileb://lambdas/resize/lambda.zip \ - --handler handler.handler \ - --dead-letter-config TargetArn=arn:aws:sns:us-east-1:000000000000:failed-resize-topic \ - --role arn:aws:iam::000000000000:role/lambda-role -``` - -### Connect the S3 bucket to the resizer lambda - -```bash -awslocal s3api put-bucket-notification-configuration \ - --bucket localstack-thumbnails-app-images \ - --notification-configuration "{\"LambdaFunctionConfigurations\": [{\"LambdaFunctionArn\": \"$(awslocal lambda get-function --function-name resize | jq -r .Configuration.FunctionArn)\", \"Events\": [\"s3:ObjectCreated:*\"]}]}" -``` - -### Create the static s3 webapp - -```bash -awslocal s3 mb s3://webapp -awslocal s3 sync --delete ./website s3://webapp -awslocal s3 website s3://webapp --index-document index.html -``` - -### Using the application - -Once deployed, visit http://webapp.s3-website.localhost.localstack.cloud:4566 - -Paste the Function URL of the presign Lambda you created earlier into the form field. -```bash -awslocal lambda list-function-url-configs --function-name presign -awslocal lambda list-function-url-configs --function-name list -``` - -After uploading a file, you can download the resized file from the `localstack-thumbnails-app-resized` bucket. - -### Testing failures - -If the `resize` Lambda fails, an SNS message is sent to a topic that an SES subscription listens to. -An email is then sent with the raw failure message. -In a real scenario you'd probably have another lambda sitting here, but it's just for demo purposes. -Since there's no real email server involved, you can use the [SES developer endpoint](https://docs.localstack.cloud/user-guide/aws/ses/) to list messages that were sent via SES: - -```bash -curl -s http://localhost.localstack.cloud:4566/_aws/ses -``` - -An alternative is to use a service like MailHog or smtp4dev, and start LocalStack using `SMTP_HOST=host.docker.internal:1025` pointing to the mock SMTP server. - -### Run integration tests - -Once all resource are created on LocalStack, you can run the automated integration tests. - -```bash -pytest tests/ -``` - -### GitHub Action - -The demo LocalStack in CI, `.github/workflows/integration-test.yml` contains a GitHub Action that starts up LocalStack, -deploys the infrastructure to it, and then runs the integration tests. - -## Contributing - -We appreciate your interest in contributing to our project and are always looking for new ways to improve the developer experience. We welcome feedback, bug reports, and even feature ideas from the community. -Please refer to the [contributing file](CONTRIBUTING.md) for more details on how to get started. - -## Cloud Pods - -[Cloud Pods](https://docs.localstack.cloud/user-guide/tools/cloud-pods/) are a mechanism that allows you to take a snapshot of the state in your current LocalStack instance, persist it to a storage backend, and easily share it with your team members. - -You can convert your current AWS infrastructure state to a Cloud Pod using the `localstack` CLI. -Check out our [Getting Started guide](https://docs.localstack.cloud/user-guide/tools/cloud-pods/getting-started/) and [LocalStack Cloud Pods CLI reference](https://docs.localstack.cloud/user-guide/tools/cloud-pods/pods-cli/) to learn more about Cloud Pods and how to use them. - -To inject a Cloud Pod you can use [Cloud Pods Launchpad](https://docs.localstack.cloud/user-guide/tools/cloud-pods/launchpad/) wich quickly injects Cloud Pods into your running LocalStack container. - -Click here [![LocalStack Pods Launchpad](https://localstack.cloud/gh/launch-pod-badge.svg)](https://app.localstack.cloud/launchpad?url=https://github.com/localstack/sample-serverless-image-resizer-s3-lambda/releases/download/latest/release-pod.zip) to launch the Cloud Pods Launchpad and inject the Cloud Pod for this application by clicking the `Inject` button. - - -Alternatively, you can inject the pod by using the `localstack` CLI. -First, you need to download the pod you want to inject from the [releases](https://github.com/localstack/sample-serverless-image-resizer-s3-lambda/releases). -Then run: - -```sh -localstack pod load file://$(pwd)/release-pod.zip -``` diff --git a/01-serverless-image-resizer/bin/deploy.sh b/01-serverless-image-resizer/bin/deploy.sh deleted file mode 100755 index 53fb904..0000000 --- a/01-serverless-image-resizer/bin/deploy.sh +++ /dev/null @@ -1,129 +0,0 @@ -#!/bin/bash - -jq --version || { - echo "Please make sure you install jq before running the deploy script" - echo " Mac: brew install jq" - echo " Ubuntu: sudo apt install jq" - exit 1 -} - -export AWS_ACCOUNT_ID=000000000000 -if [ "$AWS_DEFAULT_REGION" = "" ]; then - export AWS_DEFAULT_REGION=us-east-1 -fi - -awslocal s3 mb s3://localstack-thumbnails-app-images -awslocal s3 mb s3://localstack-thumbnails-app-resized - -awslocal ssm put-parameter --name /localstack-thumbnail-app/buckets/images --type "String" --value "localstack-thumbnails-app-images" -awslocal ssm put-parameter --name /localstack-thumbnail-app/buckets/resized --type "String" --value "localstack-thumbnails-app-resized" - -awslocal sns create-topic --name failed-resize-topic -awslocal sns subscribe \ - --topic-arn arn:aws:sns:$AWS_DEFAULT_REGION:$AWS_ACCOUNT_ID:failed-resize-topic \ - --protocol email \ - --notification-endpoint my-email@example.com - -(cd lambdas/presign; rm -f lambda.zip; zip lambda.zip handler.py) -awslocal lambda create-function \ - --function-name presign \ - --runtime python3.10 \ - --timeout 10 \ - --zip-file fileb://lambdas/presign/lambda.zip \ - --handler handler.handler \ - --role arn:aws:iam::$AWS_ACCOUNT_ID:role/lambda-role - -awslocal lambda wait function-active-v2 --function-name presign - -awslocal lambda create-function-url-config \ - --function-name presign \ - --auth-type NONE - -(cd lambdas/list; rm -f lambda.zip; zip lambda.zip handler.py) -awslocal lambda create-function \ - --function-name list \ - --runtime python3.10 \ - --timeout 10 \ - --zip-file fileb://lambdas/list/lambda.zip \ - --handler handler.handler \ - --role arn:aws:iam::$AWS_ACCOUNT_ID:role/lambda-role - -awslocal lambda wait function-active-v2 --function-name list - -awslocal lambda create-function-url-config \ - --function-name list \ - --auth-type NONE - -os=$(uname -s) -if [ "$os" == "Darwin" ] || [ "$CODESPACES" != "true" ]; then - ( - cd lambdas/resize - rm -rf lambda.zip - docker run --platform linux/x86_64 -v "$PWD":/var/task "public.ecr.aws/sam/build-python3.10" /bin/sh -c "pip install -r requirements.txt -t libs; exit" - (cd libs && zip -r ../lambda.zip .) - zip lambda.zip handler.py - ) -else - ( - cd lambdas/resize - rm -rf package lambda.zip - mkdir -p package - pip install -r requirements.txt -t package - zip lambda.zip handler.py - cd package - zip -r ../lambda.zip * - ) -fi - -awslocal lambda create-function \ - --function-name resize \ - --runtime python3.10 \ - --timeout 10 \ - --zip-file fileb://lambdas/resize/lambda.zip \ - --handler handler.handler \ - --dead-letter-config TargetArn=arn:aws:sns:$AWS_DEFAULT_REGION:$AWS_ACCOUNT_ID:failed-resize-topic \ - --role arn:aws:iam::$AWS_ACCOUNT_ID:role/lambda-role - -awslocal lambda wait function-active-v2 --function-name resize - -# additionally expose API Gateway endpoints for the list/presign Lambdas, to enable path-based execution in Codespaces -presignLambdaArn=arn:aws:lambda:$AWS_DEFAULT_REGION:$AWS_ACCOUNT_ID:function:presign -apiId=$(awslocal apigatewayv2 create-api --name presign --protocol-type HTTP --tags '_custom_id_=presign' | jq -r .ApiId) -intId=$(awslocal apigatewayv2 create-integration --api-id $apiId --integration-type AWS_PROXY --payload-format-version 2.0 --integration-uri $presignLambdaArn | jq -r .IntegrationId) -awslocal apigatewayv2 create-route --api-id $apiId --authorization-type NONE --route-key "GET /{proxy+}" --target "integrations/$intId" | jq -r .RouteId -awslocal apigatewayv2 create-stage --api-id $apiId --stage-name '$default' --auto-deploy - -listLambdaArn=arn:aws:lambda:$AWS_DEFAULT_REGION:$AWS_ACCOUNT_ID:function:list -apiId=$(awslocal apigatewayv2 create-api --name list --protocol-type HTTP --tags '_custom_id_=list' | jq -r .ApiId) -intId=$(awslocal apigatewayv2 create-integration --api-id $apiId --integration-type AWS_PROXY --payload-format-version 2.0 --integration-uri $listLambdaArn | jq -r .IntegrationId) -awslocal apigatewayv2 create-route --api-id $apiId --authorization-type NONE --route-key "GET /" --target "integrations/$intId" | jq -r .RouteId -awslocal apigatewayv2 create-stage --api-id $apiId --stage-name '$default' --auto-deploy - - -awslocal s3api put-bucket-notification-configuration \ - --bucket localstack-thumbnails-app-images \ - --notification-configuration "{\"LambdaFunctionConfigurations\": [{\"LambdaFunctionArn\": \"$(awslocal lambda get-function --function-name resize | jq -r .Configuration.FunctionArn)\", \"Events\": [\"s3:ObjectCreated:*\"]}]}" - -awslocal s3 mb s3://webapp -awslocal s3 sync --delete ./website s3://webapp -awslocal s3 website s3://webapp --index-document index.html - -echo "---------------------------------------------------------------------" -echo "" -echo "🎉 Success!" -echo "" - -# print the function URLs -echo "Function URL for 'presign' Lambda: $(awslocal lambda list-function-url-configs --function-name presign | jq -r '.FunctionUrlConfigs[0].FunctionUrl')" -echo "Function URL for 'list' Lambda: $(awslocal lambda list-function-url-configs --function-name list | jq -r '.FunctionUrlConfigs[0].FunctionUrl')" -echo -echo "Note: When using Codespaces, we need to use slightly different Lambda function endpoints." -echo "Replace '' with the endpoint of your Codespace environment in the URLs below:" -echo "'presign' Lambda: https://-4566.preview.app.github.dev/restapis/presign/dev/_user_request_" -echo "'list' Lambda: https://-4566.preview.app.github.dev/restapis/list/dev/_user_request_" - -# Optional: use the following to test Lambda hot reloading: -# scriptDir=$(dirname "$0") -# awslocal lambda update-function-code --function-name list --s3-bucket hot-reload --s3-key "$scriptDir/lambdas/list" -# or, when running from the terminal directly (instead of this script): -# awslocal lambda update-function-code --function-name list --s3-bucket hot-reload --s3-key "$(pwd)/lambdas/list" diff --git a/01-serverless-image-resizer/lambdas/list/handler.py b/01-serverless-image-resizer/lambdas/list/handler.py deleted file mode 100644 index a18440e..0000000 --- a/01-serverless-image-resizer/lambdas/list/handler.py +++ /dev/null @@ -1,76 +0,0 @@ -import json -import os -import typing - -import boto3 - -if typing.TYPE_CHECKING: - from mypy_boto3_s3 import S3Client - from mypy_boto3_ssm import SSMClient - -endpoint_url = os.getenv("AWS_ENDPOINT_URL") - -s3: "S3Client" = boto3.client("s3", endpoint_url=endpoint_url) -ssm: "SSMClient" = boto3.client("ssm", endpoint_url=endpoint_url) - - -def get_bucket_name_images() -> str: - parameter = ssm.get_parameter(Name="/localstack-thumbnail-app/buckets/images") - return parameter["Parameter"]["Value"] - - -def get_bucket_name_resized() -> str: - parameter = ssm.get_parameter(Name="/localstack-thumbnail-app/buckets/resized") - return parameter["Parameter"]["Value"] - - -def handler(event, context): - images_bucket = get_bucket_name_images() - images = s3.list_objects(Bucket=images_bucket) - - result = {} - # collect the original images - for obj in images.get("Contents", []): - result[obj["Key"]] = { - "Name": obj["Key"], - "Timestamp": obj["LastModified"].isoformat(), - "Original": { - "Size": obj["Size"], - "URL": s3.generate_presigned_url( - ClientMethod="get_object", - Params={"Bucket": images_bucket, "Key": obj["Key"]}, - ExpiresIn=3600, - ), - }, - } - - # collect the associated resized images - resized_bucket = get_bucket_name_resized() - images = s3.list_objects(Bucket=resized_bucket) - for obj in images.get("Contents", []): - if obj["Key"] not in result: - continue - result[obj["Key"]]["Resized"] = { - "Size": obj["Size"], - "URL": s3.generate_presigned_url( - ClientMethod="get_object", - Params={"Bucket": resized_bucket, "Key": obj["Key"]}, - ExpiresIn=3600, - ), - } - - result = list(sorted(result.values(), key=lambda k: k["Timestamp"], reverse=True)) - - if "routeKey" in event: - # looks like an API Gateway event -> convert to JSON string - result = json.dumps(result) - - # Note: modify result here, to test Lambda hot reloading. For example, uncomment the following code: - # result = [] - # result.append({"Name": "Test Entry", "Original": {}, "Resized": {"URL":"https://localstack.cloud/images/header-logo-new.svg"}}) - - return result - - -if __name__ == "__main__": - print(handler(None, None)) diff --git a/01-serverless-image-resizer/lambdas/presign/handler.py b/01-serverless-image-resizer/lambdas/presign/handler.py deleted file mode 100644 index 771b71b..0000000 --- a/01-serverless-image-resizer/lambdas/presign/handler.py +++ /dev/null @@ -1,49 +0,0 @@ -import json -import os -import typing - -import boto3 -from botocore.exceptions import ClientError - -if typing.TYPE_CHECKING: - from mypy_boto3_s3 import S3Client - from mypy_boto3_ssm import SSMClient - -endpoint_url = os.getenv("AWS_ENDPOINT_URL") - -s3: "S3Client" = boto3.client("s3", endpoint_url=endpoint_url) -ssm: "SSMClient" = boto3.client("ssm", endpoint_url=endpoint_url) - - -def get_bucket_name() -> str: - parameter = ssm.get_parameter(Name="/localstack-thumbnail-app/buckets/images") - return parameter["Parameter"]["Value"] - - -def handler(event, context): - bucket = get_bucket_name() - - key = event["rawPath"].lstrip("/") - if not key: - raise ValueError("no key given") - - # make sure the bucket exists - s3.create_bucket(Bucket=bucket) - - # make sure the object does not exist - try: - s3.head_object(Bucket=bucket, Key=key) - return {"statusCode": 409, "body": f"{bucket}/{key} already exists"} - except ClientError as e: - if e.response["ResponseMetadata"]["HTTPStatusCode"] != 404: - raise - - # generate the pre-signed POST url - url = s3.generate_presigned_post(Bucket=bucket, Key=key) - - # return it! - return {"statusCode": 200, "body": json.dumps(url)} - - -if __name__ == "__main__": - print(handler(None, None)) diff --git a/01-serverless-image-resizer/lambdas/resize/handler.py b/01-serverless-image-resizer/lambdas/resize/handler.py deleted file mode 100644 index 2e773ab..0000000 --- a/01-serverless-image-resizer/lambdas/resize/handler.py +++ /dev/null @@ -1,61 +0,0 @@ -# adapted from https://docs.aws.amazon.com/lambda/latest/dg/with-s3-tutorial.html -import os -import typing -import uuid -from urllib.parse import unquote_plus - -import boto3 -from PIL import Image - -if typing.TYPE_CHECKING: - from mypy_boto3_s3 import S3Client - from mypy_boto3_ssm import SSMClient - -MAX_DIMENSIONS = 400, 400 -"""The max width and height to scale the image to.""" - -endpoint_url = os.getenv("AWS_ENDPOINT_URL") - -s3: "S3Client" = boto3.client("s3", endpoint_url=endpoint_url) -ssm: "SSMClient" = boto3.client("ssm", endpoint_url=endpoint_url) - - -def get_bucket_name() -> str: - parameter = ssm.get_parameter(Name="/localstack-thumbnail-app/buckets/resized") - return parameter["Parameter"]["Value"] - - -def resize_image(image_path, resized_path): - with Image.open(image_path) as image: - # Calculate the thumbnail size - width, height = image.size - max_width, max_height = MAX_DIMENSIONS - if width > max_width or height > max_height: - ratio = max(width / max_width, height / max_height) - width = int(width / ratio) - height = int(height / ratio) - size = width, height - # Generate the resized image - image.thumbnail(size) - image.save(resized_path) - - -def download_and_resize(bucket, key) -> str: - tmpkey = key.replace("/", "") - download_path = f"/tmp/{uuid.uuid4()}{tmpkey}" - upload_path = f"/tmp/resized-{tmpkey}" - s3.download_file(bucket, key, download_path) - resize_image(download_path, upload_path) - return upload_path - - -def handler(event, context): - target_bucket = get_bucket_name() - - for record in event["Records"]: - source_bucket = record["s3"]["bucket"]["name"] - key = unquote_plus(record["s3"]["object"]["key"]) - print(source_bucket, key) - - resized_path = download_and_resize(source_bucket, key) - s3.upload_file(resized_path, target_bucket, key) diff --git a/01-serverless-image-resizer/lambdas/resize/requirements.txt b/01-serverless-image-resizer/lambdas/resize/requirements.txt deleted file mode 100644 index a6d4d60..0000000 --- a/01-serverless-image-resizer/lambdas/resize/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -Pillow==9.2.0 diff --git a/01-serverless-image-resizer/requirements-dev.txt b/01-serverless-image-resizer/requirements-dev.txt deleted file mode 100644 index cf19395..0000000 --- a/01-serverless-image-resizer/requirements-dev.txt +++ /dev/null @@ -1,11 +0,0 @@ -boto3 -requests>=2.20 -Pillow==9.2.0 -mypy_boto3_ssm -mypy_boto3_sns -mypy_boto3_s3 -mypy_boto3_lambda -black -pytest -awscli -awscli-local diff --git a/01-serverless-image-resizer/tests/nyan-cat.png b/01-serverless-image-resizer/tests/nyan-cat.png deleted file mode 100644 index 0535986153fcf34d0d926ffaefa1bc0be4fe2de9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 15044 zcmeHOcU)6;2yWfCL=?7LP7n1l}>NCbom8bs-0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<^WbS5ly)Tyv!Bnu9Jlc>3=UdVicPp_=hvXRVbRG^8@m{IRA2um33| zJ_2<7asU1Q7V^j0={z}os*l6%jI;I)ub|@XTgB&X-YBlbbs3r-!8{NVcLRLnw!}oS zXv_sh@E`w^!CP$m2@&4H^dF*P@YSnFqY5hN72PbfS#Yu#E))Y(*Pw%IT-9tnP<-qf zO_=DHk)~mUP!7HCD{tHWDhvY#mh`tGow~|?-j?*gsp(^0i>QvkfI;;M2${&OukQWP zKT^Ci9bd!Vg { - if (url.match(/https?:\/\/[\d.]+(:\d+)?\/.*/)) { - const parsedUrl = new URL(url); - const parsedUrlWithHost = new URL(urlWithHost); - parsedUrl.hostname = parsedUrlWithHost.hostname; - parsedUrl.protocol = parsedUrlWithHost.protocol; - url = parsedUrl.href; - } - return url; - }; - - $("#configForm").submit(function (event) { - if (event.preventDefault) - event.preventDefault(); - else - event.returnValue = false; - - event.preventDefault(); - - let action = $(this).find("button[type=submit]:focus").attr('name'); - - if (action == "save") { - localStorage.setItem("functionUrlPresign", $("#functionUrlPresign").val()); - localStorage.setItem("functionUrlList", $("#functionUrlList").val()); - alert("Configuration saved"); - } else if (action == "clear") { - localStorage.removeItem("functionUrlPresign"); - localStorage.removeItem("functionUrlList"); - $("#functionUrlPresign").val("") - $("#functionUrlList").val("") - alert("Configuration cleared"); - } else { - alert("Unknown action"); - } - - }); - - $("#uploadForm").submit(function (event) { - $("#uploadForm button").addClass('disabled'); - - if (event.preventDefault) - event.preventDefault(); - else - event.returnValue = false; - - event.preventDefault(); - - let fileName = $("#customFile").val().replace(/C:\\fakepath\\/i, ''); - let functionUrlPresign = $("#functionUrlPresign").val(); - - // modify the original form - console.log(fileName, functionUrlPresign); - - let urlToCall = functionUrlPresign + "/" + fileName - console.log(urlToCall); - - let form = this; - - $.ajax({ - url: urlToCall, - success: function (data) { - console.log("got pre-signed POST URL", data); - if (!data.fields) { - data = JSON.parse(data); - } - - // set form fields to make it easier to serialize - let fields = data.fields; - $(form).attr("action", data.url); - for (let key in fields) { - $("#" + key).val(fields[key]); - } - - let formData = new FormData($("#uploadForm")[0]); - console.log("sending form data", formData); - - // make sure we have the right hostname in the presigned URL - let url = injectHostnameInUrl(data.url, functionUrlPresign); - - $.ajax({ - type: "POST", - url, - data: formData, - processData: false, - contentType: false, - success: function () { - alert("success!"); - updateImageList(); - }, - error: function () { - alert("error! check the logs"); - }, - complete: function (event) { - console.log("done", event); - $("#uploadForm button").removeClass('disabled'); - } - }); - }, - error: function (e) { - console.log("error", e); - alert("error getting pre-signed URL. check the logs!"); - $("#uploadForm button").removeClass('disabled'); - } - }); - }); - - function updateImageList() { - let listUrl = $("#functionUrlList").val(); - if (!listUrl) { - alert("Please set the function URL of the list Lambda"); - return - } - if (!listUrl.endsWith("/")) { - listUrl += "/"; - } - - $.ajax({ - url: listUrl, - success: function (response) { - $('#imagesContainer').empty(); // Empty imagesContainer - response = response || []; - if (!Array.isArray(response)) { - response = JSON.parse(response); - } - response.forEach(function (item) { - console.log(item); - const functionUrlPresign = $("#functionUrlPresign").val(); - if (item.Original && item.Original.URL) { - item.Original.URL = injectHostnameInUrl(item.Original.URL, functionUrlPresign); - } - if (item.Resized && item.Resized.URL) { - item.Resized.URL = injectHostnameInUrl(item.Resized.URL, functionUrlPresign); - } - let cardHtml = imageItemTemplate(item); - $("#imagesContainer").append(cardHtml); - }); - }, - error: function (jqXHR, textStatus, errorThrown) { - console.log("Error:", textStatus, errorThrown); - alert("error! check the logs"); - } - }); - } - - $("#updateImageListButton").click(function (event) { - updateImageList(); - }); - - if (functionUrlList) { - updateImageList(); - } - -})(jQuery); diff --git a/01-serverless-image-resizer/website/favicon.ico b/01-serverless-image-resizer/website/favicon.ico deleted file mode 100644 index 2e20dd390f5053e17ce52c9186e158763cf522a4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 15086 zcmdU$3v`s_nSdu`qqXZcVQtrJce5Gkw#QxAu6s7w?&+Q-vuj1g8yK((O1R`Q_X!AS zD1u!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piI(Q!2B&fqK=(dPDy&`K*t9GPLpGR@6_417yXcOSL4ZmHM3g-DIm)UBdx z$_A`o7|!;@_Ifh#sWnCq_k47}YSgJNntowI_j2ktN3gX7z9m5~D#1IJpyrfd-3h+$ z1bd!f-3e+nhodi*{((9I&k^`-*66X zAdmanKtF(cDOtoUuS*Vy4_{AjZ$O{H*_TDE^Ez{l{D~g&hHc|3{_cD^;*%>gx%aYs z?*#uQ=6*=Nw`t3bWlwCne&*-<`V8`k%eWtTEivuaiLJigu{7{aZK2=QI^XANsr0xK zK6lZPkmrki&JS0PA|BsD9?(i0-a-tXApTAednbqi6Znc2eB`vg=A-wk%-tvPq!CjQ zyGz_I@uS4dM$GDUm&<&<-@leSOvEYqAX_`_{8-Pg-}sSjZryQxt~To;QL2iLYO3Vf5f%|<-4#Q(znc+lB=I9S}g zFEFWjuYVG;(xmtn-<{NT#}k`oV;jqfPfp2q#2LA*b-sTrbK^!V@{n&;b6fBp;*XP@ z!Ka9MPT`AB;g3?hlL=uUp1qQ}Ps-W8>o)JUmf1eZ(c;E=I^VmBcx@_kb>j?^SV{b- z_>yRuoXgdGzYPa{9?9+E#(5O-tRl{v%3R$z1MInS*4CY#FQ38OFJK!p z4td?*U~b$v$K3Ac;=7r@)2DaqmAP_GzFE<&U*_8n-_f7Z8=6Rbec#b(?gD)O6z1v% zvprYNnb*qCI^X^rdt{#{vsWFlcRfj%ljuz{_ZT((xKY!6&f!qYk)_BZ2=&-h=4p9! UvBUAG%i-97#E}#t - - - - Serverless image resizer - - - - - - -
-
- - Serverless thumbnail generator - -
- -
-
-
- Configuration -
-
-
- Set the Lambda Function URLs here -
-
-
- - -
-
- - -
-
- - -
-
-
-
-
- -
-

Upload your file

-
-
-
- Input -
-
-
Form
-

- This form calls the presign Lambda to request a S3 pre-signed POST URL, - and then forwards the POST request directly to S3. - Resizing the image to max 400x400 pixels happens asynchronously through S3 bucket notifications. - If the resizing of an image fails, then an SNS message will be sent, which will trigger an SES email - notification. You can find those by visiting http://localhost.localstack.cloud:4566/_aws/ses -

-
-
- - -
-
- -
- - - - - -
-
-
-
- -
-
-
-

List your files

-
-
- -
-
-

- The images you uploaded should be shown here. - When the refresh action is triggered, the browser makes a request to the list Lambda URL - which returns a JSON document of all items in the images and the resized images bucket. The Javascript - then populates the list below using a Handlebars template. -

-
-
-
-
-
- Created by the LocalStack team - © 2023 -
-
- - - - - - - - - - - - - - - - - diff --git a/02-serverless-api-ecs-apigateway/.gitignore b/02-serverless-api-ecs-apigateway/.gitignore deleted file mode 100644 index efee2d9..0000000 --- a/02-serverless-api-ecs-apigateway/.gitignore +++ /dev/null @@ -1,323 +0,0 @@ -# Local .terraform directories -**/.terraform/* - -# Lockfiles -.terraform.lock.hcl - -# .tfstate files -*.tfstate -*.tfstate.* - -# Crash log files -crash.log -crash.*.log - -# Exclude all .tfvars files, which are likely to contain sensitive data, such as -# password, private keys, and other secrets. These should not be part of version -# control as they are data points which are potentially sensitive and subject -# to change depending on the environment. -*.tfvars -*.tfvars.json - -# Ignore override files as they are usually used to override resources locally and so -# are not checked in -override.tf -override.tf.json -*_override.tf -*_override.tf.json - -# Ignore CLI configuration files -.terraformrc -terraform.rc - -# Logs -logs -*.log -npm-debug.log* -yarn-debug.log* -yarn-error.log* -lerna-debug.log* -.pnpm-debug.log* - -# Diagnostic reports (https://nodejs.org/api/report.html) -report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json - -# Runtime data -pids -*.pid -*.seed -*.pid.lock - -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov - -# Coverage directory used by tools like istanbul -coverage -*.lcov - -# nyc test coverage -.nyc_output - -# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# Bower dependency directory (https://bower.io/) -bower_components - -# node-waf configuration -.lock-wscript - -# Compiled binary addons (https://nodejs.org/api/addons.html) -build/Release - -# Dependency directories -node_modules/ -jspm_packages/ - -# Snowpack dependency directory (https://snowpack.dev/) -web_modules/ - -# TypeScript cache -*.tsbuildinfo - -# Optional npm cache directory -.npm - -# Optional eslint cache -.eslintcache - -# Optional stylelint cache -.stylelintcache - -# Microbundle cache -.rpt2_cache/ -.rts2_cache_cjs/ -.rts2_cache_es/ -.rts2_cache_umd/ - -# Optional REPL history -.node_repl_history - -# Output of 'npm pack' -*.tgz - -# Yarn Integrity file -.yarn-integrity - -# dotenv environment variable files -.env -.env.development.local -.env.test.local -.env.production.local -.env.local - -# parcel-bundler cache (https://parceljs.org/) -.cache -.parcel-cache - -# Next.js build output -.next -out - -# Nuxt.js build / generate output -.nuxt -dist - -# Gatsby files -.cache/ -# Comment in the public line in if your project uses Gatsby and not Next.js -# https://nextjs.org/blog/next-9-1#public-directory-support -# public - -# vuepress build output -.vuepress/dist - -# vuepress v2.x temp and cache directory -.temp -.cache - -# Docusaurus cache and generated files -.docusaurus - -# Serverless directories -.serverless/ - -# FuseBox cache -.fusebox/ - -# DynamoDB Local files -.dynamodb/ - -# TernJS port file -.tern-port - -# Stores VSCode versions used for testing VSCode extensions -.vscode-test - -# yarn v2 -.yarn/cache -.yarn/unplugged -.yarn/build-state.yml -.yarn/install-state.gz -.pnp.* - -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[cod] -*$py.class - -# C extensions -*.so - -# Distribution / packaging -.Python -build/ -develop-eggs/ -dist/ -downloads/ -eggs/ -.eggs/ -lib/ -lib64/ -parts/ -sdist/ -var/ -wheels/ -share/python-wheels/ -*.egg-info/ -.installed.cfg -*.egg -MANIFEST - -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. -*.manifest -*.spec - -# Installer logs -pip-log.txt -pip-delete-this-directory.txt - -# Unit test / coverage reports -htmlcov/ -.tox/ -.nox/ -.coverage -.coverage.* -.cache -nosetests.xml -coverage.xml -*.cover -*.py,cover -.hypothesis/ -.pytest_cache/ -cover/ - -# Translations -*.mo -*.pot - -# Django stuff: -*.log -local_settings.py -db.sqlite3 -db.sqlite3-journal - -# Flask stuff: -instance/ -.webassets-cache - -# Scrapy stuff: -.scrapy - -# Sphinx documentation -docs/_build/ - -# PyBuilder -.pybuilder/ -target/ - -# Jupyter Notebook -.ipynb_checkpoints - -# IPython -profile_default/ -ipython_config.py - -# pyenv -# For a library or package, you might want to ignore these files since the code is -# intended to run in multiple environments; otherwise, check them in: -# .python-version - -# pipenv -# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. -# However, in case of collaboration, if having platform-specific dependencies or dependencies -# having no cross-platform support, pipenv may install dependencies that don't work, or not -# install all needed dependencies. -#Pipfile.lock - -# poetry -# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. -# This is especially recommended for binary packages to ensure reproducibility, and is more -# commonly ignored for libraries. -# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control -#poetry.lock - -# pdm -# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. -#pdm.lock -# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it -# in version control. -# https://pdm.fming.dev/#use-with-ide -.pdm.toml - -# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm -__pypackages__/ - -# Celery stuff -celerybeat-schedule -celerybeat.pid - -# SageMath parsed files -*.sage.py - -# Environments -.env -.venv -env/ -venv/ -ENV/ -env.bak/ -venv.bak/ - -# Spyder project settings -.spyderproject -.spyproject - -# Rope project settings -.ropeproject - -# mkdocs documentation -/site - -# mypy -.mypy_cache/ -.dmypy.json -dmypy.json - -# Pyre type checker -.pyre/ - -# pytype static type analyzer -.pytype/ - -# Cython debug symbols -cython_debug/ - -# PyCharm -# JetBrains specific template is maintained in a separate JetBrains.gitignore that can -# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore -# and can be added to the global gitignore or merged into this file. For a more nuclear -# option (not recommended) you can uncomment the following to ignore the entire idea folder. -#.idea/ \ No newline at end of file diff --git a/02-serverless-api-ecs-apigateway/LICENSE b/02-serverless-api-ecs-apigateway/LICENSE deleted file mode 100644 index 261eeb9..0000000 --- a/02-serverless-api-ecs-apigateway/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/02-serverless-api-ecs-apigateway/Makefile b/02-serverless-api-ecs-apigateway/Makefile deleted file mode 100644 index 404de4b..0000000 --- a/02-serverless-api-ecs-apigateway/Makefile +++ /dev/null @@ -1,55 +0,0 @@ -export AWS_ACCESS_KEY_ID ?= test -export AWS_SECRET_ACCESS_KEY ?= test -export AWS_DEFAULT_REGION=us-east-1 -SHELL := /bin/bash - -usage: ## Show this help - @fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//' - -install: ## Install dependencies - @which localstack || pip install localstack - @which awslocal || pip install awscli-local - @which tflocal || pip install --upgrade terraform-local - -terraform-setup: ## Set up Terraform - cd terraform; \ - tflocal init; \ - echo "Deploying Terraform configuration 🚀"; \ - tflocal apply --auto-approve; - -cloudformation-setup: ## Set up CloudFormation - cd cloudformation; \ - STACK="stack1"; \ - CF_FILE="ecsapi-demo-cloudformation.yaml"; \ - echo "Deploying CloudFormation stack 🚀"; \ - awslocal cloudformation create-stack --stack-name $$STACK --template-body file://$$CF_FILE; \ - -run: ## Run the sample app - @echo "Building Web assets and uploading to local S3 bucket đŸĒŖ"; \ - cd client-application-react; \ - test -e node_modules || yarn; \ - test -e build/index.html || NODE_OPTIONS=--openssl-legacy-provider yarn build; \ - awslocal s3 mb s3://sample-app; \ - awslocal s3 sync build s3://sample-app; \ - API_ID=$$(awslocal apigatewayv2 get-apis | jq -r '.Items[] | select(.Name=="ecsapi-demo") | .ApiId'); \ - POOL_ID=$$(awslocal cognito-idp list-user-pools --max-results 1 | jq -r '.UserPools[0].Id'); \ - CLIENT_ID=$$(awslocal cognito-idp list-user-pool-clients --user-pool-id $$POOL_ID | jq -r '.UserPoolClients[0].ClientId'); \ - URL="http://sample-app.s3.localhost.localstack.cloud:4566/index.html?stackregion=us-east-1&stackhttpapi=$$API_ID&stackuserpool=$$POOL_ID&stackuserpoolclient=$$CLIENT_ID"; \ - echo "Check out the sample application 🤩"; \ - echo $$URL - -start: ## Start LocalStack in detached mode - EXTRA_CORS_ALLOWED_ORIGINS=http://sample-app.s3.localhost.localstack.cloud:4566 DISABLE_CUSTOM_CORS_APIGATEWAY=1 localstack start -d - -stop: ## Stop the running LocalStack container - @echo - localstack stop - -ready: ## Make sure the LocalStack container is up - @echo Waiting on the LocalStack container... - @localstack wait -t 30 && echo LocalStack is ready to use! || (echo Gave up waiting on LocalStack, exiting. && exit 1) - -logs: ## Save the logs in a logs.txt file - @localstack logs > logs.txt - -.PHONY: usage install run start stop ready logs diff --git a/02-serverless-api-ecs-apigateway/README.md b/02-serverless-api-ecs-apigateway/README.md deleted file mode 100644 index a6e850f..0000000 --- a/02-serverless-api-ecs-apigateway/README.md +++ /dev/null @@ -1,299 +0,0 @@ -# Serverless Container-based APIs with Amazon ECS and Amazon API Gateway - -| Key | Value | -| ------------ | ------------------------------------------------------------------------------------- | -| Environment | | -| Services | S3, DynamoDB, Elastic Container Service, API Gateway, Cognito, IAM | -| Integrations | Terraform, CloudFormation, AWS CLI | -| Categories | Serverless; Containers; Security, Identity, and Compliance | -| Level | Intermediate | -| GitHub | [Repository link](https://github.com/localstack/serverless-api-ecs-apigateway-sample) | - -## Introduction - -The Serverless Container-based APIs with Amazon ECS and Amazon API Gateway application sample demonstrate how you can launch and test a sample container-based API. This application sample implements an example API with two services — “Food store” to `PUT` & `GET` foods, and “Pet store” to `PUT` & `GET` pets. The application client is implemented using ReactJS, which allows unauthenticated users to use only `GET` requests, while authenticated users can utilize `GET` and `PUT` requests. Users can deploy this application sample on AWS & LocalStack using CloudFormation & Terraform with minimal changes. To test this application sample, we will demonstrate how you use LocalStack to deploy the infrastructure on your developer machine and your CI environment. - -## Architecture diagram - -The following diagram shows the architecture that this sample application builds and deploys: - -![Architecture diagram for Serverless Container-based APIs with Amazon ECS and Amazon API Gateway sample application](./images/serverless-container-api.png) - -We are using the following AWS services and their features to build our infrastructure: - -- [Elastic Container Service](https://docs.localstack.cloud/user-guide/aws/elastic-container-service/) to create and deploy our containerized application. -- [DynamoDB](https://docs.localstack.cloud/user-guide/aws/dynamodb/) as a key-value and document database to persist our data. -- [API Gateway](https://docs.localstack.cloud/user-guide/aws/apigatewayv2/) to expose the containerized services to the user through HTTP APIs. -- [Cognito User Pools](https://docs.localstack.cloud/user-guide/aws/cognito/) for user authentication and authorizing requests to container APIs. -- [Amplify](https://docs.localstack.cloud/user-guide/aws/amplify/) to create the user client with ReactJS to send requests to container APIs. -- [S3](https://docs.localstack.cloud/user-guide/aws/s3/) to deploy the Amplify application to make the web application available to users. -- [IAM](https://docs.localstack.cloud/user-guide/aws/iam/) to create policies to specify roles and permissions for various AWS services. - -## Prerequisites - -- LocalStack Pro with the [`localstack` CLI](https://docs.localstack.cloud/getting-started/installation/#localstack-cli). -- [AWS CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) with the [`awslocal` wrapper](https://docs.localstack.cloud/user-guide/integrations/aws-cli/#localstack-aws-cli-awslocal). -- [Terraform](https://docs.localstack.cloud/user-guide/integrations/terraform/) with the [`tflocal` wrapper](https://docs.localstack.cloud/user-guide/integrations/terraform/#using-the-tflocal-script). -- [Node.js](https://nodejs.org/en/download/) with `npm` package manager. - -Start LocalStack Pro with the appropriate configuration to enable the S3 website to send requests to the container APIs: - -```shell -export LOCALSTACK_AUTH_TOKEN= -EXTRA_CORS_ALLOWED_ORIGINS=http://sample-app.s3.localhost.localstack.cloud:4566 DISABLE_CUSTOM_CORS_APIGATEWAY=1 DEBUG=1 localstack start -``` - -The `DISABLE_CUSTOM_CORS_APIGATEWAY` configuration variable disables CORS override by API Gateway. The `EXTRA_CORS_ALLOWED_ORIGINS` configuration variable allows our website to send requests to the container APIs. -We specified DEBUG=1 to get the printed LocalStack logs directly in the terminal (it helps later, when we need to get the Cognito confirmation code). -If you prefer running LocalStack in detached mode, you can add the `-d` flag to the `localstack start` command, and use Docker Desktop to view the logs. - -## Instructions - -You can build and deploy the sample application on LocalStack by running our `Makefile` commands. Run `make terraform-setup` or `make cloudformation-setup` to create the infrastructure on LocalStack. -Run `make run` to deploy the S3 Website and get a URL to access the application. Run `make stop` to delete the infrastructure by stopping LocalStack. - -Alternatively, here are instructions to deploy it manually step-by-step. - -## Creating the infrastructure - -To create the AWS infrastructure locally, you can either use Terraform or CloudFormation. - -### Terraform - -To create the infrastructure using Terraform, run the following commands: - -```shell -cd terraform -tflocal init -tflocal apply --auto-approve -``` - -We are using the `tflocal` wrapper to configure the local service endpoints, and send the API requests to LocalStack, instead of AWS. You can use the same Terraform configuration to deploy the infrastructure on AWS as well. - -#### CloudFormation - -To create the infrastructure using CloudFormation, run the following commands: - -```shell -cd cloudformation -export STACK="stack1" -awslocal cloudformation create-stack --stack-name $STACK --template-body file://ecsapi-demo-cloudformation.yaml -``` - -Wait for a few seconds for the infrastructure to be created. You can check the status of the stack using the following command: - -```shell -awslocal cloudformation describe-stacks --stack-name $STACK | grep StackStatus -``` - -If the `StackStatus` is `CREATE_COMPLETE`, you can proceed to the next step. - -## Building the web application - -To build the web application, navigate to the root directory of the sample application and run the following commands: - -```shell -cd client-application-react -yarn -NODE_OPTIONS=--openssl-legacy-provider yarn build -``` - -Ensure a `build` directory is created in the `client-application-react` directory. - -## Deploying the web application - -To deploy the web application, we will make an S3 bucket and sync the `build` directory to the S3 bucket. Run the following commands from the `client-application-react` directory: - -```shell -awslocal s3 mb s3://sample-app -awslocal s3 sync build s3://sample-app -``` - -To access the web application, you can run the following commands: - -```shell -export API_ID=$(awslocal apigatewayv2 get-apis | jq -r '.Items[] | select(.Name=="ecsapi-demo") | .ApiId') -export POOL_ID=$(awslocal cognito-idp list-user-pools --max-results 1 | jq -r '.UserPools[0].Id') -export CLIENT_ID=$(awslocal cognito-idp list-user-pool-clients --user-pool-id $POOL_ID | jq -r '.UserPoolClients[0].ClientId') -export URL="http://sample-app.s3.localhost.localstack.cloud:4566/index.html?stackregion=us-east-1&stackhttpapi=$API_ID&stackuserpool=$POOL_ID&stackuserpoolclient=$CLIENT_ID" -echo $URL -``` - -## Testing the web application - -To test the web application, follow these steps: - -- Open your application URL in your browser if it is displayed in the terminal. -- Create a user by clicking the **Go to Sign In!** button and navigating to the **Create Account** page. -- Follow the prompts to fill in your details, and click the **Create account** button. -- You will be prompted to enter a confirmation code displayed in the terminal, in the LocalStack logs. Use this code to confirm your Account. - -Once you have confirmed your Account, skip the email recovery step, as that endpoint is not yet implemented. The application endpoints can now add and retrieve information on your pets and food. You will find a few entries in the resources folder to get you started and explore the application. - -![Serverless Container-based APIs with Amazon ECS and Amazon API Gateway Web Interface](./images/interface.png) - -### Visualizing your data - -Navigate to [**app.localstack.cloud**](https://app.localstack.cloud/) and go to **Resources** -> **DynamoDB**. You can now see the tables created, as well as the data stored in them: - -![Displaying DynamoDB tables in the LocalStack Web Application](./images/web-app-tables.png) - -![Displaying DynamoDB table items in the LocalStack Web Application](./images/web-app-items.png) - -Alternatively, you can use the AWS CLI to query the table data. For example, to query the `FoodStoreFoods` table, run the following command: - -```bash -awslocal dynamodb scan --table-name FoodStoreFoods -``` - - -### Write a small unit test - -To test our application, we could write a simple unit test in Python. -Let us make a simple example, assuming that we have the requirements that: -- each item in the `TablePetstoreFood` table has a `foodName` key; -- each item in the `TablePetstorePets` table has a `petName` key; - -A trivial test case would look like this: - -```python -import pytest -import boto3 - - -endpoint_url = "http://localhost.localstack.cloud:4566" - -@pytest.mark.parametrize('tableName,key', [("TablePetstoreFood", "foodName"), ("TablePetstorePets", "petName")]) -def test_database(tableName, key): - dynamodb = boto3.client("dynamodb", endpoint_url=endpoint_url, region_name='us-east-1', aws_access_key_id="test", - aws_secret_access_key="test") - - response = dynamodb.scan(TableName=tableName) - - items = response["Items"] - - for item in items: - assert key in item -``` - -To make this test succeeds, we would need to first put some data in our application. Naturally, such data should be as close as possible to the "production" data. This action is usually called _seeding_ of the testing environment. -In the next step, we will explore [Cloud Pods](https://docs.localstack.cloud/user-guide/tools/cloud-pods/) as a tool to do such seeding. - -## Cloud Pods - -[Cloud Pods](https://docs.localstack.cloud/user-guide/tools/cloud-pods/) are a mechanism that allows you to take a snapshot of the state in your current LocalStack instance, persist it to a storage backend, and easily share it with your team members. - -To save your local AWS infrastructure state using Cloud Pods, you can use the `save` command with a desired name for your Cloud Pod as the first argument: - -```bash -localstack pod save -``` - -You can alternatively use the `save` command with a local file path as the first argument to save the Cloud Pod on your local file system and not the LocalStack Web Application: - -```bash -localstack pod save file:/// -``` - -The above command will create a zip file named `` to the specified location on the disk. - -The `load` command is the inverse operation of the `save` command. It retrieves the content of a previously stored Cloud Pod from the local file system or the LocalStack Web Application and injects it into the application runtime. On an alternate machine, start LocalStack with the auth token configured, and pull the Cloud Pod we created previously using the `load` command with the Cloud Pod name as the first argument: - -```bash -localstack pod load -``` - -### Generate the seed data - -Let us now generate some seeding data. -First, let us restart LocalStack to have a clean instance. -Then, let us execute the [following script](https://github.com/giograno/serverless-api-ecs-apigateway-sample/tree/main/cloud-pod-seed-tests/table.sh) to simply create the two DynamoDB tables and insert some data. - -``` -#!/bin/bash - -awslocal dynamodb create-table --cli-input-json file://food.json - -awslocal dynamodb create-table --cli-input-json file://pet.json - -awslocal dynamodb put-item \ - --table-name TablePetstorePets \ - --item '{ - "petId": {"S": "1"}, - "petName": {"S": "Dog"} - }' \ - --return-consumed-capacity TOTAL - - -awslocal dynamodb put-item \ - --table-name TablePetstoreFood \ - --item '{ - "foodId": {"S": "1"}, - "foodName": {"S": "Cat food"} - }' \ - --return-consumed-capacity TOTAL -``` - -Finally, we export a Cloud Pod with the following command: - -``` -localstack pod save file://bootstrap -``` - -Conceptually, we are now able to: - -- start our application; -- simply seed the test environment with some data; -- run our unit tests. - -In the next step, we will see how to do all this in CI. - - -## GitHub Action - -This application sample hosts an example GitHub Action workflow that starts up LocalStack, deploys the infrastructure, and checks the created resources using `awslocal`. You can find the workflow in the `.github/workflows/main.yml` file. To run the workflow, you can fork this repository and push a commit to the `main` branch. - -The most relevant steps in the CI pipeline are: - -- Starting LocalStack, after setting the auth token as a secret in GitHub. - -```yaml - - name: Start LocalStack - env: - LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }} - DNS_ADDRESS: 0 - run: | - pip install localstack awscli-local[ver1] - pip install terraform-local - docker pull localstack/localstack-pro:latest - - # Start LocalStack in the background - localstack start -d -``` - -- Load the Cloud Pod with the seeding data after starting the application - -```yaml - - name: Seed test environment with Cloud Pod - run: | - localstack pod load https://raw.githubusercontent.com/giograno/serverless-api-ecs-apigateway-sample/main/cloud-pods-seed-tests/bootstrap - sleep 10 -``` - -- Finally, run the tests - -```yaml - - name: Run tests - run: | - cd tests - pip install pytest - pip install boto3 - pytest . -``` - - -Users can adapt this example workflow to run in their own CI environment. LocalStack supports various CI environments, including GitHub Actions, CircleCI, Jenkins, Travis CI, and more. You can find more information about the CI integration in the [LocalStack documentation](https://docs.localstack.cloud/user-guide/ci/). - -## Learn more - -The sample application is based on a public [AWS sample app](https://github.com/aws-samples/ecs-apigateway-sample) that deploys ECS containers with API Gateway to connect to. See this AWS blog post for more details: [Field Notes: Serverless Container-based APIs with Amazon ECS and Amazon API Gateway.](https://aws.amazon.com/blogs/architecture/field-notes-serverless-container-based-apis-with-amazon-ecs-and-amazon-api-gateway/) diff --git a/02-serverless-api-ecs-apigateway/client-application-react/.gitignore b/02-serverless-api-ecs-apigateway/client-application-react/.gitignore deleted file mode 100644 index 6401dae..0000000 --- a/02-serverless-api-ecs-apigateway/client-application-react/.gitignore +++ /dev/null @@ -1,40 +0,0 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -/node_modules -/.pnp -.pnp.js -.eslintcache - -# testing -/coverage - -# production -/build - -# misc -.DS_Store -.env.local -.env.development.local -.env.test.local -.env.production.local - -npm-debug.log* -yarn-debug.log* -yarn-error.log* - -#amplify -amplify/\#current-cloud-backend -amplify/.config/local-* -amplify/mock-data -amplify/backend/amplify-meta.json -amplify/backend/awscloudformation -build/ -dist/ -node_modules/ -aws-exports.js -awsconfiguration.json -amplifyconfiguration.json -amplify-build-config.json -amplify-gradle-config.json -amplifyxc.config diff --git a/02-serverless-api-ecs-apigateway/client-application-react/amplify/backend/backend-config.json b/02-serverless-api-ecs-apigateway/client-application-react/amplify/backend/backend-config.json deleted file mode 100644 index 9e26dfe..0000000 --- a/02-serverless-api-ecs-apigateway/client-application-react/amplify/backend/backend-config.json +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/02-serverless-api-ecs-apigateway/client-application-react/amplify/team-provider-info.json b/02-serverless-api-ecs-apigateway/client-application-react/amplify/team-provider-info.json deleted file mode 100644 index 20583c9..0000000 --- a/02-serverless-api-ecs-apigateway/client-application-react/amplify/team-provider-info.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "dev": { - "awscloudformation": { - "AuthRoleName": "amplify-ecsapidemotestapi-dev-164209-authRole", - "UnauthRoleArn": "arn:aws:iam::315359227436:role/amplify-ecsapidemotestapi-dev-164209-unauthRole", - "AuthRoleArn": "arn:aws:iam::315359227436:role/amplify-ecsapidemotestapi-dev-164209-authRole", - "Region": "us-east-1", - "DeploymentBucketName": "amplify-ecsapidemotestapi-dev-164209-deployment", - "UnauthRoleName": "amplify-ecsapidemotestapi-dev-164209-unauthRole", - "StackName": "amplify-ecsapidemotestapi-dev-164209", - "StackId": "arn:aws:cloudformation:us-east-1:315359227436:stack/amplify-ecsapidemotestapi-dev-164209/6aa03c30-a0f1-11ea-b1b7-0e29088293c9", - "AmplifyAppId": "d13a5c9356pwbf" - } - } -} \ No newline at end of file diff --git a/02-serverless-api-ecs-apigateway/client-application-react/package.json b/02-serverless-api-ecs-apigateway/client-application-react/package.json deleted file mode 100644 index 270774d..0000000 --- a/02-serverless-api-ecs-apigateway/client-application-react/package.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "react-amplified", - "version": "0.1.0", - "private": true, - "dependencies": { - "@aws-amplify/ui-react": "^1.2.20", - "@testing-library/jest-dom": "^5.14.1", - "@testing-library/react": "^12.1.2", - "@testing-library/user-event": "^7.2.1", - "aws-amplify": "^4.3.2", - "react": "^16.14.0", - "react-dom": "^16.14.0" - }, - "devDependencies": { - "react-scripts": "^4.0.2" - }, - "scripts": { - "start": "react-scripts start", - "build": "react-scripts build", - "test": "react-scripts test", - "eject": "react-scripts eject" - }, - "eslintConfig": { - "extends": "react-app" - }, - "browserslist": { - "production": [ - ">0.2%", - "not dead", - "not op_mini all" - ], - "development": [ - "last 1 chrome version", - "last 1 firefox version", - "last 1 safari version" - ] - } - } diff --git a/02-serverless-api-ecs-apigateway/client-application-react/public/favicon.ico b/02-serverless-api-ecs-apigateway/client-application-react/public/favicon.ico deleted file mode 100644 index bcd5dfd67cd0361b78123e95c2dd96031f27f743..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3150 zcmaKtc{Ei0AIGn;MZ^<@lHD*OV;K7~W1q3jSjJcqNywTkMOhP*k~Oj?GO|6{m(*C2 zC7JA+hN%%Bp7T4;J@?%2_x=5zbI<2~->=X60stMr0B~{wzpi9D0MG|# zyuANt7z6;uz%?PEfAnimLl^)6h5ARwGXemG2>?hqQv-I^Gpyh$JH}Ag92}3{$a#z& zd`il2Sb#$U&e&4#^4R|GTgk!Qs+x*PCL{2+`uB5mqtnqLaaw`*H2oqJ?XF(zUACc2 zSibBrdQzcidq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serverless-api-ecs-apigateway/client-application-react/public/index.html b/02-serverless-api-ecs-apigateway/client-application-react/public/index.html deleted file mode 100644 index aa069f2..0000000 --- a/02-serverless-api-ecs-apigateway/client-application-react/public/index.html +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - React App - - - -
- - - diff --git a/02-serverless-api-ecs-apigateway/client-application-react/public/logo192.png b/02-serverless-api-ecs-apigateway/client-application-react/public/logo192.png deleted file mode 100644 index fc44b0a3796c0e0a64c3d858ca038bd4570465d9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5347 zcmZWtbyO6NvR-oO24RV%BvuJ&=?+<7=`LvyB&A_#M7mSDYw1v6DJkiYl9XjT!%$dLEBTQ8R9|wd3008in6lFF3GV-6mLi?MoP_y~}QUnaDCHI#t z7w^m$@6DI)|C8_jrT?q=f8D?0AM?L)Z}xAo^e^W>t$*Y0KlT5=@bBjT9kxb%-KNdk zeOS1tKO#ChhG7%{ApNBzE2ZVNcxbrin#E1TiAw#BlUhXllzhN$qWez5l;h+t^q#Eav8PhR2|T}y5kkflaK`ba-eoE+Z2q@o6P$)=&` z+(8}+-McnNO>e#$Rr{32ngsZIAX>GH??tqgwUuUz6kjns|LjsB37zUEWd|(&O!)DY zQLrq%Y>)Y8G`yYbYCx&aVHi@-vZ3|ebG!f$sTQqMgi0hWRJ^Wc+Ibv!udh_r%2|U) zPi|E^PK?UE!>_4`f`1k4hqqj_$+d!EB_#IYt;f9)fBOumGNyglU(ofY`yHq4Y?B%- zp&G!MRY<~ajTgIHErMe(Z8JG*;D-PJhd@RX@QatggM7+G(Lz8eZ;73)72Hfx5KDOE zkT(m}i2;@X2AT5fW?qVp?@WgN$aT+f_6eo?IsLh;jscNRp|8H}Z9p_UBO^SJXpZew zEK8fz|0Th%(Wr|KZBGTM4yxkA5CFdAj8=QSrT$fKW#tweUFqr0TZ9D~a5lF{)%-tTGMK^2tz(y2v$i%V8XAxIywrZCp=)83p(zIk6@S5AWl|Oa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wATcdM_6+yWIO z*ZRH~uXE@#p$XTbCt5j7j2=86e{9>HIB6xDzV+vAo&B?KUiMP|ttOElepnl%|DPqL b{|{}U^kRn2wo}j7|0ATu<;8xA7zX}7|B6mN diff --git a/02-serverless-api-ecs-apigateway/client-application-react/public/manifest.json b/02-serverless-api-ecs-apigateway/client-application-react/public/manifest.json deleted file mode 100644 index 080d6c7..0000000 --- a/02-serverless-api-ecs-apigateway/client-application-react/public/manifest.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "short_name": "React App", - "name": "Create React App Sample", - "icons": [ - { - "src": "favicon.ico", - "sizes": "64x64 32x32 24x24 16x16", - "type": "image/x-icon" - }, - { - "src": "logo192.png", - "type": "image/png", - "sizes": "192x192" - }, - { - "src": "logo512.png", - "type": "image/png", - "sizes": "512x512" - } - ], - "start_url": ".", - "display": "standalone", - "theme_color": "#000000", - "background_color": "#ffffff" -} diff --git a/02-serverless-api-ecs-apigateway/client-application-react/public/robots.txt b/02-serverless-api-ecs-apigateway/client-application-react/public/robots.txt deleted file mode 100644 index 2d1aa03..0000000 --- a/02-serverless-api-ecs-apigateway/client-application-react/public/robots.txt +++ /dev/null @@ -1,3 +0,0 @@ -# https://www.robotstxt.org/robotstxt.html -User-agent: * -Disallow: / \ No newline at end of file diff --git a/02-serverless-api-ecs-apigateway/client-application-react/src/App.css b/02-serverless-api-ecs-apigateway/client-application-react/src/App.css deleted file mode 100644 index 74b5e05..0000000 --- a/02-serverless-api-ecs-apigateway/client-application-react/src/App.css +++ /dev/null @@ -1,38 +0,0 @@ -.App { - text-align: center; -} - -.App-logo { - height: 40vmin; - pointer-events: none; -} - -@media (prefers-reduced-motion: no-preference) { - .App-logo { - animation: App-logo-spin infinite 20s linear; - } -} - -.App-header { - background-color: #282c34; - min-height: 100vh; - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - font-size: calc(10px + 2vmin); - color: white; -} - -.App-link { - color: #61dafb; -} - -@keyframes App-logo-spin { - from { - transform: rotate(0deg); - } - to { - transform: rotate(360deg); - } -} diff --git a/02-serverless-api-ecs-apigateway/client-application-react/src/App.js b/02-serverless-api-ecs-apigateway/client-application-react/src/App.js deleted file mode 100644 index 86c7dd9..0000000 --- a/02-serverless-api-ecs-apigateway/client-application-react/src/App.js +++ /dev/null @@ -1,212 +0,0 @@ -// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -// SPDX-License-Identifier: MIT - -import React from 'react' -import { Amplify, Auth } from 'aws-amplify' -import { AmplifyAuthenticator, AmplifySignOut, AmplifySignUp } from '@aws-amplify/ui-react' -import { onAuthUIStateChange } from '@aws-amplify/ui-components' -// import awsconfig from './aws-exports' -import axios from 'axios' - -const searchParams = new URLSearchParams( window.location.search ) -const searchParamsList = { - regionID: searchParams.get('stackregion'), - HttpApiID: searchParams.get('stackhttpapi'), - UserPoolID: searchParams.get('stackuserpool'), - UserPoolClientID: searchParams.get('stackuserpoolclient'), -} -if( !searchParamsList.regionID.match(/^[a-zA-Z0-9\-]+$/) ){ throw new Error('Invalid Region ID!!'); } -if( !searchParamsList.HttpApiID.match(/^[a-zA-Z0-9\-]+$/) ){ throw new Error('Invalid API ID!!'); } -const awsconfig = {}; -awsconfig.Auth = { - region: searchParamsList.regionID, - userPoolId: searchParamsList.UserPoolID, - userPoolWebClientId: searchParamsList.UserPoolClientID, - endpoint: 'http://localhost:4566' -} -Amplify.configure(awsconfig) -Auth.configure(awsconfig) - -var MyPropsMethods = {} - -const App = () => { - return ( - - ) -} - -const MyAuth = () => { - - const [authState, setAuthState] = React.useState() - const [showLogin, setShowLogin] = React.useState(false) - const goToSignIn = () => setShowLogin(true) - const exitFromSignIn = () => setShowLogin(false) - const showAuthenticator = (showLogin || authState == 'signedin') - const showApp = (!showLogin || authState == 'signedin') - const showgoToSignIn = !(showLogin || authState == 'signedin') && authState != null - - React.useEffect(() => { - return onAuthUIStateChange(newAuthState => { - setAuthState(newAuthState) - if(newAuthState=='signedin'){ - setShowLogin(false) - } - }) - }, []) - - return ( -
- -
-
- -
- - - - -
- - { showApp && -
- { showgoToSignIn && } - -
- } - -
- ) - -} - -MyPropsMethods.APIProperties = { - 'foodstore/foods/':['foodId'], - 'petstore/pets/':['petId'], -} - -const ApiForm = (props) => { - - const [selectedMethod, setSelectedMethod] = React.useState() - const [selectedAPI, setSelectedAPI] = React.useState() - const [selectedVariable, setSelectedVariable] = React.useState() - const [selectedPayload, setSelectedPayload] = React.useState() - - const handleMethodChange = (e) => setSelectedMethod(e.target.value) - const handleAPIChange = (e) => setSelectedAPI(e.target.value) - const handleVariableChange = (e) => setSelectedVariable(e.target.value) - const handlePayloadChange = (e) => setSelectedPayload( selectedMethod == 'GET' ? undefined : e.target.value ) - - const pathVariable = selectedAPI ? MyPropsMethods.APIProperties[selectedAPI][0] : '' - - const enableFormSubmission = !!( selectedMethod && selectedAPI && selectedVariable && ( selectedMethod == 'GET' || selectedPayload ) ) - - return ( -
-
MyPropsMethods.invokeAPI(e,enableFormSubmission, selectedMethod, selectedAPI, selectedVariable, selectedPayload, props.authState) }> -

- { props.authState == 'signedin' - ? Looks like you're signed in! - : Looks like you're NOT signed in - } -

-

- { props.authState == 'signedin' - ? You should be able to invoke GET and also PUT. Try it out! - : You should be able to invoke GET but not PUT. Try it out! - } -

-
-
- Method: -
- -
- -
-
-
-
-
- API: -
- -
- -
-
-
-
-
- {'{'+pathVariable+'}'}:
- -
-
-
- Body (JSON):
-