Skip to content

Lambda — Verify

Progress checklist

Invoke the function and read the JSON response to confirm the file system is mounted and accessible at /mnt/s3files.

  1. Confirm base exports. Required

    Terminal window
    export AWS_REGION=ap-southeast-6
    export FUNCTION_NAME=s3files-demo
  2. 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.json

    Expected response:

    {"statusCode": 200, "body": "[]"}

    An empty list [] is correct for a newly created file system. The function successfully listed /mnt/s3files.

  3. 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 name
    aws 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.json

    The response body should now list ['hello.txt'].

  4. 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'].

When you are finished, run Teardown to remove the file system config, delete access points, and clean up all resources.