Project contains Lambda, which is calculating the power of number. It can be activated via request GET HTTP with query parameters /power?number=<integer>&power=<integer>
GET HTTP /power?number=2&power=3
RESPONSE
200 "Content-Type": "application/json"
{"result": 8}
To build project use make init
Source code should be zipped and uploaded to S3 Bucket
To check whether it is there use make check-lambda-code and look for app.zip
When the code is provided use make apply to build AWS resources.
You can retrieve function name for CLI calls with make function-name or url to API Gateway to f.e. curl Lambda with make lambda-base-url
In order to validate working of lambda use make invoke-lambda number=<int> power=<int> (f.e. make invoke-lambda number=2 power=3) to call it directly.
To destroy project use make destroy
| Name | Version |
|---|---|
| terraform | >= 0.13.0 |
| aws | >= 3.48 |
| aws_vault | >= 6.0 |
| Name | Version |
|---|---|
| aws | >= 3.48 |
| random | >= 3.1.0 |
| archive | >= 2.2.0 |
| Name | Type |
|---|---|
| random_pet.lambda_bucket_name | resource |
| aws_s3_bucket.lambda_source_code | resource |
| aws_s3_bucket_object.lambda_source_code | resource |
| aws_lambda_function.app | resource |
| aws_cloudwatch_log_group.app | resource |
| aws_iam_role.lambda_exec | resource |
| aws_iam_role_policy_attachment.lambda_policy | resource |
| aws_apigatewayv2_api.lambda | resource |
| aws_apigatewayv2_stage.lambda | resource |
| aws_apigatewayv2_integration.app | resource |
| aws_apigatewayv2_route.app | resource |
| aws_cloudwatch_log_group.api_gw | resource |
| aws_lambda_permission.api_gw | resource |
| archive_file.lambda_source_code | data source |