This a mono-repo several packages to serve as an example getting up and running with Remix on AWS using AWS CDK.
It uses @remix-run/architect
for the Remix bindings to AWS Lambda, but deploys via CDK. The arc tools (e.g. arc sandbox
) can still be used for local development.
It comprises of 2 packages:
remix-starter-architect
- The default Architect starter when runningnpm init remix
cdk
- An AWS CDK project to deployremix-starter-apigateway
git clone git@github.com:m14t/starter-aws-cdk.git
cd starter-aws-cdk
npm ci
The following steps need to be ran once before you can use AWS CDK on your account.
- Configure your AWS credentials.
- Boostrap your environment.
npm run bootstrap #installs NPM dependencies in all child projects cd cdk cdk bootstrap
us-east-1
will also need to be cdk bootstrapped because Lambda@Edge functions are deployed there.
The remix-stack-config.ts
can be used to configure your deployment. It
contains the following options:
Key | Default | Description |
---|---|---|
stackname |
remix |
The name of the CloudFormation stack that will be created |
domainName |
The domain name to be used as an alias for the CloudFront CDN distribution | |
lambdaMemorySize |
128 |
The amount of memory, in MB, to assign to the lambda function. After deploying, you can use lumigo-cli powertune-lambda to determine the best value to use here |
lambdaEnvironmentVariables |
An object of key/value pairs of the ENV variables that you want to expose to your lambda function | |
certificateArn |
The ARN for the AWS Certificate Manager certificate for the domainName |
|
hostedZoneId & zoneName |
If both of these values are provided, then an A Record will be created in this hosted Zone for the domainName |
The following command will use CDK to create a CloudFormation stack for the remix-starter-apigateway
package.
npm run deploy
cd cdk
cdk destroy