{"id":25743151,"url":"https://github.com/fun-with-serverless/legacy-app-blog","last_synced_at":"2026-06-10T18:32:17.404Z","repository":{"id":279101755,"uuid":"937142121","full_name":"fun-with-serverless/legacy-app-blog","owner":"fun-with-serverless","description":"Move your legacy apps to the cloud using cloud native tools","archived":false,"fork":false,"pushed_at":"2025-04-18T18:00:36.000Z","size":63,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-04-19T06:47:55.732Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fun-with-serverless.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-02-22T12:44:10.000Z","updated_at":"2025-04-18T18:00:39.000Z","dependencies_parsed_at":null,"dependency_job_id":"3bc16bd7-90a9-4d8b-961b-2c3ea8e2a501","html_url":"https://github.com/fun-with-serverless/legacy-app-blog","commit_stats":null,"previous_names":["fun-with-serverless/legacy-app-blog"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/fun-with-serverless/legacy-app-blog","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fun-with-serverless%2Flegacy-app-blog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fun-with-serverless%2Flegacy-app-blog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fun-with-serverless%2Flegacy-app-blog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fun-with-serverless%2Flegacy-app-blog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fun-with-serverless","download_url":"https://codeload.github.com/fun-with-serverless/legacy-app-blog/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fun-with-serverless%2Flegacy-app-blog/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34165482,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-10T02:00:07.152Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-02-26T10:18:48.127Z","updated_at":"2026-06-10T18:32:17.398Z","avatar_url":"https://github.com/fun-with-serverless.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Legacy App Deployment Example\n\nThis repository demonstrates how to move legacy applications to the cloud using cloud-native tools, showcasing multiple deployment options for a Node.js Express application.\n\nRelated blog post (in Hebrew) - https://pashut.cloud/lift-and-shift-app-runner-part-1\n\n## Repository Structure\n\n- **legacy-app/** - Contains the Express application that lists AWS Lambda functions\n  - `index.mjs` - Main application code\n  - `Dockerfile` - Container definition for the application\n  - `package.json` - Node.js dependencies and scripts\n\n- **apprunner/** - Contains AWS App Runner deployment configuration\n  - `app-runner-service.yaml` - CloudFormation template for deploying to App Runner\n  - `create-role.yaml` - CloudFormation template for creating necessary IAM roles\n\n- **lwa/** - Contains AWS Lambda Web Adapter configuration\n  - `Dockerfile` - Extends the legacy app image and adds Lambda Web Adapter\n  - `template.yaml` - SAM template for deploying as a Lambda function\n\n## Prerequisites\n\n- [Node.js](https://nodejs.org/) (v20 or later)\n- [Docker](https://www.docker.com/)\n- [AWS CLI](https://aws.amazon.com/cli/) configured with appropriate credentials\n- [AWS SAM CLI](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html) (for Lambda deployment)\n- AWS account with permissions to:\n  - Create and push to ECR repositories\n  - Deploy CloudFormation stacks\n  - Create App Runner services and Lambda functions\n  - List Lambda functions\n\n## Running the Legacy App Locally\n\n### Using Node.js directly\n\n1. Navigate to the legacy app directory:\n   ```\n   cd legacy-app\n   ```\n\n2. Install dependencies:\n   ```\n   npm ci\n   ```\n\n3. Start the application:\n   ```\n   npm start\n   ```\n\n4. Access the application at http://localhost:3000/lambdas\n\n### Using Docker\n\n1. Build the Docker image:\n   ```\n   cd legacy-app\n   npm run build\n   ```\n\n2. Run the Docker container:\n   ```\n   npm run docker:start\n   ```\n\n3. Access the application at http://localhost:3000/lambdas\n\n## Deploying to AWS App Runner\n\nThe application includes scripts to deploy to AWS App Runner using the CloudFormation templates in the `apprunner/` directory.\n\n1. First, create the ECR repository (if you haven't already):\n   ```\n   aws cloudformation deploy --template-file legacy-app/template.yaml --stack-name lambda-list-app-ecr\n   ```\n\n2. Deploy the application to AWS:\n   ```\n   cd legacy-app\n   npm run aws:deploy\n   ```\n\n   This command performs the following actions:\n   - Builds the Docker image (`npm run build`)\n   - Authenticates with AWS ECR (`npm run aws:authenticate`)\n   - Tags and pushes the image to ECR (`npm run aws:push`)\n\n3. Deploy the App Runner service:\n   ```\n   aws cloudformation deploy --template-file apprunner/app-runner-service.yaml --stack-name lambda-list-app-apprunner --capabilities CAPABILITY_NAMED_IAM\n   ```\n\nAfter deployment, you can find the App Runner service URL in the AWS Console or by checking the CloudFormation stack outputs.\n\n## Deploying as Lambda with AWS Lambda Web Adapter\n\nThe application can also be deployed as an AWS Lambda function using the AWS Lambda Web Adapter.\n\n### How It Works\n\n1. The Dockerfile in the `lwa` directory extends the existing `lambda-list-app` Docker image and adds the Lambda Web Adapter.\n2. The SAM template (`template.yaml`) defines an AWS Lambda function that uses this Docker image and configures a Lambda URL for HTTP access.\n\n### Building and Deploying\n\n1. First, ensure the base Docker image is built:\n   ```\n   cd legacy-app\n   npm run build\n   ```\n\n2. Then deploy the Lambda function using SAM:\n   ```\n   cd lwa\n   sam build\n   sam deploy --guided\n   ```\n\n   During the guided deployment, you can set a stack name and choose your region. SAM will package and deploy the function to AWS Lambda and create a Lambda URL.\n\n### Testing\n\nAfter deployment, SAM will output the Lambda Function URL. You can test the API endpoints using this URL:\n\n- Health check: `\u003cfunction-url\u003e/health-check`\n- List Lambda functions: `\u003cfunction-url\u003e/lambdas`\n\n### Cleaning Up\n\nTo remove the deployed Lambda resources:\n   ```\n   sam delete\n   ```\n\n### Notes\n- The Lambda function is configured with 512MB of memory and a 30-second timeout. You can adjust these values in the template.yaml file if needed.\n- The AWS Lambda Web Adapter automatically handles the translation between HTTP requests and Lambda invocations.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffun-with-serverless%2Flegacy-app-blog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffun-with-serverless%2Flegacy-app-blog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffun-with-serverless%2Flegacy-app-blog/lists"}