https://github.com/flexstack/rails-cdk
An example for deploying a Rails app to AWS Fargate with AWS CDK
https://github.com/flexstack/rails-cdk
aws-apigateway aws-cloudfront aws-fargate cdk cdk-examples rails rails-cdk rails-examples
Last synced: 3 months ago
JSON representation
An example for deploying a Rails app to AWS Fargate with AWS CDK
- Host: GitHub
- URL: https://github.com/flexstack/rails-cdk
- Owner: flexstack
- License: mit
- Created: 2024-08-06T18:51:55.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-08-06T21:46:52.000Z (11 months ago)
- Last Synced: 2025-02-13T12:24:22.877Z (5 months ago)
- Topics: aws-apigateway, aws-cloudfront, aws-fargate, cdk, cdk-examples, rails, rails-cdk, rails-examples
- Language: Ruby
- Homepage:
- Size: 93.8 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Rails on AWS Fargate with AWS CDK
## Architecture
See the [CDK code](./infra/bin/infra.ts) for the full architecture.
- A VPC with public, private, private isolated subnets
- An ECS cluster with a Fargate service
- A Route 53 private hosted zone for the ECS service (AWS CloudMap/Service Discovery)
- API Gateway w/ VPC Link Integration to the ECS service using the private DNS name
- An ECS task definition with a container that runs the Rails app
- A CloudFront distribution with an API Gateway origin## Deploy to AWS with CDK
First, you need to install [aws-cdk](https://www.npmjs.com/package/aws-cdk).
Next, create an [SSM parameter](https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-parameter-store.html)
with the Rails master key at `/rails-cdk/prod/RAILS_MASTER_KEY`. Your master key can be found in the `config/master.key` file.
This key is used to decrypt the Rails credentials file in the ECS task definition.```bash
cd infra
npm install
# Bootstrap the CDK environment
cdk bootstrap --qualifier railscdk
# Deploy the stacks
cdk deploy --all
```