This repository provides a robust setup for deploying Node.js (will work with both TS and JS) type of applications onto AWS Elastic Beanstalk using AWS CodePipeline and the AWS Cloud Development Kit (CDK).
If you want to attach Route53 hosted zone subdomain: route53 hosted zone version
- 🚀 Automated Deployment: Seamless deployment of an Express.js application onto Elastic Beanstalk.
- 🔁 CI/CD Integration: Fully integrated with CodePipeline for a smooth CI/CD experience.
- 📦 CodeBuild Integration: Uses AWS CodeBuild to install application dependencies and prepare it for deployment.
- 📡 CodeCommit or GitHub Integration: Fetches the source code directly from a specified CodeCommit or GitHub repository.
- AWS Command Line Interface (CLI) installed and configured.
- AWS Cloud Development Kit (CDK) CLI installed.
- Node.js and npm installed on your local machine.
- A GitHub or CodeCommit repository containing the source code of your Node.js application (ts or js).
-
Rename
config.sample.yaml
toconfig.yaml
: Update this file with the necessary details, including the Git repository name, its owner, your GitHub access token, if repo is GitHub and any environment-specific configurations. -
Bootstrap the AWS CDK: If this is your first time using CDK on your AWS account or region, initialize your environment with:
cdk bootstrap
-
Deploy the CDK Stack: Use the CDK CLI to deploy your stack:
cdk deploy
-
Push Changes & Watch Magic Happen: With your pipeline now set up, any subsequent pushes to your specified GitHub branch will trigger your pipeline. This will rebuild your application and redeploy it to Elastic Beanstalk.
To ensure you don't continue incurring AWS charges, remember to destroy the resources when not in use:
cdk destroy
Ensure your IAM permissions are appropriately set to allow the CDK to manage AWS resources on your behalf. Additionally, ensure that your GitHub token has the right permissions, especially for accessing the repository and triggering webhooks.
Contributions are more than welcome! Feel free to fork this repository, make your improvements, and then submit them back through a pull request.