The Nautilus DevOps team continues to explore serverless architecture by setting up another Lambda function. This time, the task must be completed using the AWS Console to familiarize the team with the web interface. The function will return a custom greeting and demonstrate the capabilities of AWS Lambda effectively.
-
Create Python Script: Create a Python script named
lambda_function.py
with a function that returns the bodyWelcome to KKE AWS Labs!
and status code200
. -
Zip the Python Script: Zip the script into a file named
function.zip
. -
Create Lambda Function: Create a Lambda function named
xfusion-lambda-cli
using the zipped file and specifyPython
as the runtime. -
IAM Role: Use the IAM role named
lambda_execution_role
.
Use AWS CLI which is already configured on the aws-client
host.
Getting error while doing this task,
Error:
aws lambda create-function
–function-name xfusion-lambda-cli
–runtime python3.9
–zip-file fileb://function.zip
–handler lambda_function.lambda_handler
–role arn:aws:iam::211125781176:role/lambda_execution_role
–region us-east-1
An error occurred (AccessDeniedException) when calling the CreateFunction operation: User: arn:aws:iam::account_id:user/kk_labs_user_366995 is not authorized to perform: iam:PassRole on resource: arn:aws:iam::account_id:role/lambda_execution_role because no identity-based policy allows the iam:PassRole action
fetched the account id using: aws sts get-caller-identity --query ‘Account’ --output text
Is there anything i am missing or the lab has issue with I am role? are there anyone else facing same?