Hands-on emulator lab · 8–12 min
S3 and Lambda event testing
Upload a small web page, send its file details to a function, then fix a test that is missing the file name.
This lab uses your own temporary emulator. It does not access a live AWS account.
Your goal
Make a function read a message about a file you uploaded.
Why this matters
Apps often react when a file arrives, such as making a thumbnail for a photo. You will connect storage to a function and learn which information the function needs. Then you will safely break a test and repair it.
Words you will use
S3 stores files in buckets. An object is a stored file, and its key is its name. Lambda runs a small piece of code. An event is a message about something that happened.
How to proceed
Open the lab, read the goal, then follow the numbered steps. Each step names the controls and explains the result to look for.
1. Deploy your two blocks
Click Start building or Deploy stack. The S3 bucket will hold your page. The Lambda function will read the test message. Wait until both blocks say available. Deploy means creating these resources in your private emulator.
2. Connect the bucket to the function
Click Object created on the S3 block, then Function input on the Lambda block. This saves the notification setup. You can also select the bucket and use its connection menu. The saved link alone does not prove a message was delivered.
3. Predict which field names the file
Click Next step to open the question. The function needs to know which uploaded file to handle. Choose the field that carries a file name such as index.html. You can try again if your first answer does not fit.
4. Make and upload your page
Select the S3 bucket. In its controls, choose Moonbase or Cloud garden, type a page title, and click Upload your page. This stores a real index.html object in the emulator. Look for the upload result before moving on.
5. Send a test with a missing file name
Select the Lambda block and choose Send a broken event. This deliberately leaves out the object key, which is the file name. Read the error in the trace. The error is expected: the function cannot identify the file yet.
6. Repair the test and try again
In the Lambda controls, choose Test uploaded event. This puts the real uploaded file key back into the message. In the result, check that the bucket name and index.html match your upload. A successful result shows the repair worked.
7. Explain what made the function run
Click Next step to answer the last question. You pressed a button that manually called Lambda with your upload details. This lab does not observe automatic S3 delivery. Choose the answer that matches what you actually tested, then finish the mission.
Practice, then check your understanding
Repeat the lab with different input. Explain the result before claiming completion. Your live resources expire after inactivity, while your canvas stays in this browser. Guest XP stays here too; signed-in achievements sync to your account.
Read the official AWS documentation for service behavior and production details.