Static Site Generation in Lambda with React Static
MIT License
Static Site Generation in Lambda with React Static: Medium
x86_64
1024
MB (at least)512
MB (at least)15
min (maximum available)Configure the policy:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": "s3:PutObject",
"Resource": "arn:aws:s3:::${LAMBDA_S3_BUCKET_NAME}/*"
}
]
}
LAMBDA_ACCESS_KEY_ID
and LAMBDA_SECRET_ACCESS_KEY
- credentials for the AWS user to deploy files, for localLAMBDA_S3_BUCKET_NAME
- S3 bucket name to deploy files to,LAMBDA_USE_POLICY
- to use (true
) or not to use (false
) IAM policy instead of the AWS user, convenient in theLAMBDA_USE_TMPDIR
- to use (true
) or not to use (false
) temporary directory for the build artifacts, musttrue
in the actual Lambda environment, can be false
for local development usage.Make sure to set up environment variables in the .env
file (see .env.example
).
docker build -t build-react-static-in-lambda .
docker run --env-file .env -p 9000:8080 build-react-static-in-lambda
curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{}'
docker ps
docker exec -it <CONTAINER ID> bash
npm install
node lambda/without-docker