It is supposed that the user has some prior knowledge about lambda and docker.
- (Install and) Configure Docker
- Install Terraform
- Install AWS CLI
- Setup AWS credentials
aws configure
Preferred. This deployment will assume that aws configure is used.- Need
aws_access_key_id and aws_secret_access_key
key values; inside~/.aws/credentials
- Export env variables for keys mentioned in .env.example into shell session.
- example:
export TF_VAR_aws_creds_path="xxxxxxx" TF_VAR_aws_region="xxxxxxx" TF_VAR_accountId="xxxxxxx"
- example:
- Deploy using
bash deploy.sh
. The bash script does the following things:- Deploy the script to ECR using the predeploy script.
-
bash predeploy.sh
- This will create a repository in the AWS ECR and - Build and upload the docker image to the ECR. - Uses the following terraform commands to build and deploy the infrastrucutre needed for Histogram Preprocessing Tool:
terraform init
terraform plan
terraform apply
- This will create a new lambda function (using docker inn ECR)
- Configure REST API gateway for the lambda.
- Add appropriate roles and permissions.
- Add cloudwatch logs for the API and Lambda.
- And add necessary configuration for the lambda execution environment.
- Deploy the script to ECR using the predeploy script.
-
- Use the
Histogram_preprocessed_data.postman_collection.json
postman collection to test the Lambda.
After terraform finishes building the Histogram tool infrastructure, it outputs env varaibles that can be used in the frontend.
- For
<sensitive>
as output value, useterraform output <key_name>
- `terraform destroy`
- removes the Lambda function, API Gateway and permissions.
- Goto AWS ECR Management console and remove the created ECR.