0
votes

aws lambda create-function --function-name CliTestFun --runtime java8 --region ap-south-1 --role arn:aws:iam::XXXXXXXXXXXXX:role/aws-lambda-basic-execution-role --handler com.example.demo.Search::handleRequest --zip fileb:///home/workspace/example/target/testfunction-1.0.0.jar

from the above command, I am able to create the function but the problem is after I run this command I checked it in aws console, So there are so many unnecessary resources like iot,ec2,s3... added to it but I wanted to add specific resources only required to that lambda ,how can I ignore those resources when I try to create it from aws CLI.

Is it any configuration related problem or something?

1

1 Answers

0
votes

It should be because the IAM role you are attaching to the lambda function has access to the resources you are seeing the AWS console.

You may check if the below IAM role you are attaching to the lambda function has access to the resources you are seeing in the console

aws-lambda-basic-execution-role