Hi Team,
Please provide steps to create lambda function using terraform or AWS CLI. I am trying to create lambda function through terraform and betting below error.
│ Error: creating Lambda Function (hello-api-lambda): operation error Lambda: CreateFunction, https response error StatusCode: 403, RequestID: d5fc96a5-8252-4e83-a6ed-ebaafce587ab, api error AccessDeniedException: User: arn:aws:iam::135049824276:user/kk_labs_user_985733 is not authorized to perform: lambda:CreateFunction on resource: arn:aws:lambda:ap-south-1:135049824276:function:hello-api-lambda with an explicit deny in a service control policy
│
│ with aws_lambda_function.hello_lambda,
│ on main.tf line 47, in resource “aws_lambda_function” “hello_lambda”:
│ 47: resource “aws_lambda_function” “hello_lambda” {
│
It would help if you include your HCL code (please use a code block) so we can see what’s going on, and try it on different environments. Also – you may want to try the “Terraform + Localstack” playground as well as the terraform/AWS playground, since I suspect there will be fewer issues with permissions if you do that.
You are trying to create it in ap-south-1 which is not a permitted region for our labs. Use us-east-1 and you will probably get better results.
Hi @Alistair_KodeKloud , I am using us-east-1 region and not able to create lambda function through AWS CIL or terraform. getting permission issue.
The error you originally posted clearly shows ap-south-1
kk_labs_user_985733 is not authorized to perform: lambda:CreateFunction on resource:
arn:aws:lambda:ap-south-1:135049824276:function:hello-api-lambda
Please show us an error where it says us-east-1 and we can investigate.