-
Notifications
You must be signed in to change notification settings - Fork 0
/
lambda.tf
34 lines (26 loc) · 1.19 KB
/
lambda.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# The aws region that you choose for your deployment
provider "aws" {
region = "us-east-1"
}
resource "aws_lambda_function" "texttospeech" {
function_name = "texttospeech"
# The lambda function needs the code in zipped file in an S3 bucket
# The S3 bucket is created here manually and the zip file is uploaded manually. You should change this with your own details
# This will automated in the next hands-on
s3_bucket = "lambdacode17032024"
s3_key = "lambdacode.zip"
# "lambda" is the filename within the zip file and "lambda_handler"
# is the name of the function handler
handler = "lambda.lambda_handler"
runtime = "python3.8"
# Each lambda function must have an IAM role
# The lambda function must have permissions to communicate with polly in order to translate the received text on MP3 File
# and permissions to send logs to cloudwatch logs
role = aws_iam_role.lambda_exec.arn
}
# Cloudwatch_log_group will contain all lambda invocation logs
# It let you understand the behavior of your function and resolve issues
resource "aws_cloudwatch_log_group" "LambdaLogGroup" {
name = "/aws/lambda/${aws_lambda_function.texttospeech.function_name}"
retention_in_days = 30
}