0
0
AWScloud~10 mins

Lambda with API Gateway pattern in AWS - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to specify the integration type for API Gateway to invoke Lambda.

AWS
IntegrationType = "[1]"
Drag options to blanks, or click blank then click option'
AHTTP
BHTTP_PROXY
CMOCK
DAWS_PROXY
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing HTTP or HTTP_PROXY which are for HTTP backends, not Lambda.
Using MOCK which is for testing without backend.
2fill in blank
medium

Complete the code to define the HTTP method for the API Gateway resource.

AWS
httpMethod = "[1]"
Drag options to blanks, or click blank then click option'
AGET
BTRACE
CPOST
DCONNECT
Attempts:
3 left
💡 Hint
Common Mistakes
Using POST when the operation is a read-only fetch.
Choosing CONNECT or TRACE which are rarely used in API Gateway.
3fill in blank
hard

Fix the error in the Lambda function handler signature.

AWS
def lambda_handler([1], context):
    return {'statusCode': 200, 'body': 'Hello from Lambda!'}
Drag options to blanks, or click blank then click option'
Arequest
Bevent
Cinput
Ddata
Attempts:
3 left
💡 Hint
Common Mistakes
Using names like request or input which are not standard and may confuse readers.
Forgetting the event parameter causes runtime errors.
4fill in blank
hard

Fill both blanks to create a resource path and attach a GET method in API Gateway.

AWS
resource = api.root.add_resource("[1]")
resource.add_method("[2]", lambda_integration)
Drag options to blanks, or click blank then click option'
Ausers
BPOST
CGET
Dorders
Attempts:
3 left
💡 Hint
Common Mistakes
Using POST method when the instruction asks for GET.
Choosing unrelated resource names like orders when users is expected.
5fill in blank
hard

Fill all three blanks to configure Lambda permissions for API Gateway invocation.

AWS
lambda_function.add_permission(
    Action="[1]",
    Principal="[2]",
    SourceArn="[3]"
)
Drag options to blanks, or click blank then click option'
Alambda:InvokeFunction
Bapigateway.amazonaws.com
Carn:aws:execute-api:region:account-id:api-id/*/GET/resource
Ds3:PutObject
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect actions like s3:PutObject which are unrelated.
Setting Principal to a user or role instead of API Gateway service.
Incorrect SourceArn format causing permission denial.