Terraform config to deploy the transform-numbers lambda function and expose it via a REST API.
The lambda function can be invoked through the deployed API by submitting a GET request to below URL with different values for inputNumber query string.
API response will be a JSON string. Below is a sample output:
{"numberInWords":"One hundred and sixty seven thousand five hundred and thirty four"}
- AWS account (Free tier account should suffice)
- Terraform installation.
- Create a tf config file(variables.secret.tf) with below variables
variable "aws_access_key" {
description = "The AWS access key."
default = "<YOUR ACCESS KEY>"
}
variable "aws_secret_key" {
description = "The AWS secret key."
default = "<YOUR SECRET KEY>"
}
- Replace
<YOUR ACCESS KEY>and<YOUR SECRET KEY>in above config file with your AWS account access key and secret key. - Update value for
regionwith your preferred region. - To initialize terraform, execute
terraform initfrom /terraform directory. - To create a plan, execute
terraform plan -out plan.tfplan - To apply plan and create resources, execute
terraform apply plan.tfplan