Lambda — Verify
Progress checklist
Overview
Section titled “Overview”Invoke the function and read the JSON response to confirm the file system is mounted and accessible at /mnt/s3files.
-
Confirm base exports. Required
Terminal window export AWS_REGION=ap-southeast-6export FUNCTION_NAME=s3files-demo -
Invoke the function. Required
Terminal window aws lambda invoke \--function-name "$FUNCTION_NAME" \--region "$AWS_REGION" \--payload '{}' \/tmp/lambda-response.json \&& cat /tmp/lambda-response.jsonExpected response:
{"statusCode": 200, "body": "[]"}An empty list
[]is correct for a newly created file system. The function successfully listed/mnt/s3files. -
Write an object via S3 and invoke again. Required
Write a file directly to the S3 bucket at the path the access point exposes (
/lambda/):Terminal window export BUCKET=my-s3-files-bucket # ← replace with your real bucket nameaws s3 cp /dev/stdin \"s3://${BUCKET}/lambda/hello.txt" \--content-type text/plain \--region "$AWS_REGION" <<< "hello from lambda walkthrough"Invoke the function again:
Terminal window aws lambda invoke \--function-name "$FUNCTION_NAME" \--region "$AWS_REGION" \--payload '{}' \/tmp/lambda-response.json \&& cat /tmp/lambda-response.jsonThe response body should now list
['hello.txt']. -
Check CloudWatch Logs. Required
Terminal window aws logs tail \"/aws/lambda/${FUNCTION_NAME}" \--since 5m \--region "$AWS_REGION"Look for a log line like
Contents of /mnt/s3files: ['hello.txt'].
Next step
Section titled “Next step”When you are finished, run Teardown to remove the file system config, delete access points, and clean up all resources.