Study guide
Technical reference and lesson notes
Purpose of This Lesson
Amazon S3 Object Lambda lets you use an AWS Lambda function to process an object as it is retrieved from Amazon S3. Instead of returning the original object directly, S3 can invoke Lambda to transform the response before sending it to the requesting application.
This capability is useful when different consumers need different representations of the same S3 data—for example, when one application should receive a redacted version of a document while another authorized application can receive the original.
Key Concepts
Request-time transformation
S3 Object Lambda operates on GetObject responses. A client sends a request through an S3 Object Lambda access point, which invokes a Lambda function. The function reads the original object through an associated S3 access point, processes the content, and returns the transformed result.
A simplified flow is:
- The client sends
GetObjectto an S3 Object Lambda access point. - S3 invokes the configured Lambda function.
- Lambda retrieves or processes the source object through the supporting S3 access point.
- Lambda transforms the response.
- The client receives the modified content.
The transformation is performed at retrieval time. It does not require creating a second, permanently transformed copy of every object in the bucket.
Access point architecture
S3 Object Lambda uses two related access-point concepts:
- Supporting S3 access point: Provides access to the underlying bucket and object data.
- S3 Object Lambda access point: Provides the client-facing endpoint and connects the request to the Lambda transformation function.
Applications should use the Object Lambda access point when they need transformed output. Applications that need the original object can use an appropriate standard S3 access path, subject to normal IAM and bucket-policy controls.
AWS-provided transformation functions
The lesson highlights prebuilt Lambda functions that can be used instead of writing custom processing logic. AWS publishes the function ARNs and configuration guidance for these functions.
#### PII access control
This function detects personally identifiable information (PII) and restricts access when PII is found. It is appropriate when the requirement is to prevent delivery of objects containing sensitive data.
Examples of PII can include:
- Names and addresses
- Dates and other identifying information
- Credit card numbers
- Social Security numbers
#### PII redaction
This function detects PII and returns a version of the document with the detected information redacted. It is appropriate when consumers need access to the document but must not see sensitive values.
The important distinction is:
- Access control: deny or restrict delivery of content containing PII.
- Redaction: deliver the content while obscuring the PII.
#### Decompression
A prebuilt decompression function can process objects compressed with formats such as bzip2, gzip, snappy, zlib, zstandard, and ZIP. This allows clients to retrieve usable content without each client implementing its own decompression logic.
Custom Lambda transformations
You can also implement your own Lambda function for transformations that are specific to an application or data format. Possible use cases include filtering fields, converting formats, removing attributes, or applying content-specific access rules.
Custom transformations require careful consideration of Lambda execution behavior, object size, processing time, error handling, and the additional latency introduced into the read path.
Exam-Relevant Takeaways
- S3 Object Lambda modifies the response to an S3
GetObjectrequest. - The client accesses the data through an S3 Object Lambda access point.
- A Lambda function performs the transformation before the response reaches the client.
- The original object in S3 is not inherently replaced by the transformed response.
- Use PII access control when objects containing PII should be blocked.
- Use PII redaction when the object should be returned but sensitive data must be removed or obscured.
- Use the decompression function when clients need decompressed content from compressed S3 objects.
- A scenario mentioning S3 GET processing, PII detection, and response modification is a strong signal for S3 Object Lambda.
Architecture Decision Guide
| Requirement | Appropriate design choice | Why |
|---|---|---|
| Return an S3 object with PII removed | S3 Object Lambda with PII redaction | Transforms the response without requiring a separate redacted object for every source object |
| Prevent delivery of objects containing PII | S3 Object Lambda with PII access control | Detects PII and restricts access |
| Return compressed objects in decompressed form | S3 Object Lambda with the decompression function | Performs decompression during retrieval |
| Apply application-specific filtering or formatting | S3 Object Lambda with a custom Lambda function | Supports custom response processing |
| Store a permanently transformed copy for repeated downstream use | A separate processing pipeline and destination object | Better when transformation is expensive or the result is reused extensively |
| Retrieve the original, unmodified object | Standard S3 access path or suitable S3 access point | Avoids the Object Lambda transformation path |
Common Exam Traps
- Confusing S3 Object Lambda with S3 Select: S3 Select retrieves selected portions of an object using query expressions. S3 Object Lambda uses Lambda to transform the
GetObjectresponse. - Choosing Amazon Macie for response modification: Macie helps discover and classify sensitive data; it does not provide a request-time transformed S3 response.
- Assuming the source object is overwritten: Object Lambda changes what the requester receives. It is not, by itself, an object-update workflow.
- Using bucket replication for dynamic redaction: Replication creates copies and does not dynamically tailor a response for each consumer.
- Confusing access control with redaction: Access control blocks delivery, while redaction returns a modified document.
- Forgetting the access point requirement: The client request must use the S3 Object Lambda access point for the Lambda transformation to occur.
- Using CloudFront or Lambda@Edge by default: Those services can transform content at the edge, but they are not the direct S3 feature described when the requirement specifically concerns modifying S3
GetObjectresponses.
Real-World Engineer Notes
- Request-time processing adds latency and introduces Lambda execution into the object-read path.
- Validate that the Lambda function can handle the object formats and sizes expected by the application.
- Treat the transformed response as a separate security boundary: permissions for the Object Lambda access point, supporting access point, Lambda execution role, bucket, and KMS-encrypted objects must all be designed correctly.
- Decide whether consumers should have access to the original S3 access path. If they can bypass the Object Lambda access point, they may be able to retrieve untransformed data unless IAM and bucket policies prevent it.
- For frequently reused or computationally expensive transformations, precomputing and storing derived objects may be more operationally predictable and cost-effective.
- Use AWS-provided function ARNs and current regional documentation when configuring prebuilt transformations; do not assume an ARN format from memory.
Quick Reference Summary
- Service: Amazon S3 Object Lambda
- Primary operation: Transform an S3
GetObjectresponse - Processing engine: AWS Lambda
- Client endpoint: S3 Object Lambda access point
- Source data path: Supporting S3 access point to the underlying bucket
- PII access control: Detect PII and restrict delivery
- PII redaction: Detect PII and obscure it in the returned document
- Decompression: Return decompressed content from supported compressed objects
- Core exam clue: “Modify S3 object output during a GET request,” especially for PII
Flashcards
1. What does S3 Object Lambda do?
It invokes a Lambda function to process and transform an S3 object response during a GetObject request.
2. What endpoint does a client use to receive a transformed S3 object?
An S3 Object Lambda access point.
3. Does S3 Object Lambda automatically replace the source object?
No. It transforms the response returned to the requester; the source object remains separate unless an application explicitly writes a modified object back to S3.
4. When should you use the PII access-control function?
When objects containing detected PII must be blocked or access must be restricted.
5. When should you use the PII-redaction function?
When the client should receive the document but sensitive PII must be obscured or removed.
6. What is the purpose of the decompression function?
To return decompressed content from supported compressed S3 objects during retrieval.
7. What is the role of the supporting S3 access point?
It provides the Object Lambda workflow with access to the underlying S3 bucket and source object.
8. What is the strongest SAP-C02 clue for S3 Object Lambda?
A requirement to modify or filter an S3 object response during GetObject, particularly to detect or redact PII.
9. How does S3 Object Lambda differ from S3 Select?
S3 Select queries and returns selected data from an object, while S3 Object Lambda uses Lambda code to transform the response.
10. What is a key tradeoff of custom Object Lambda processing?
It adds processing latency and Lambda operational complexity to the object-read path.
Practice Questions
Question 1
A company stores customer application forms in Amazon S3. A partner application must retrieve the forms, but any detected names, addresses, and credit card numbers must be obscured before delivery. The company does not want to maintain a second redacted copy of every form. Which solution best meets the requirement?
Correct answer: Configure S3 Object Lambda with the PII redaction Lambda function and provide the partner with the S3 Object Lambda access point.
Explanation: S3 Object Lambda can transform the GetObject response at retrieval time. PII redaction returns a modified document without requiring permanently stored redacted copies.
Question 2
An organization must ensure that a downstream application cannot retrieve any S3 object that contains PII. The object should not be delivered at all when PII is detected. Which option is most appropriate?
Correct answer: Use an S3 Object Lambda access point configured with the PII access-control function.
Explanation: PII access control is intended to detect PII and restrict access. PII redaction would be appropriate only if the requirement allowed delivery of a modified document.
Question 3
An application retrieves compressed objects from Amazon S3, but the application team does not want to add decompression libraries or change the application code. Which architecture should a solutions architect recommend?
Correct answer: Route the application’s GetObject requests through an S3 Object Lambda access point using the prebuilt decompression function.
Explanation: S3 Object Lambda can process the response with Lambda and return decompressed content to the client.
Question 4
A solutions architect is asked to identify the AWS service feature that can dynamically remove selected fields from an S3 object as it is returned to different consumers. Which choice is best?
A. S3 Versioning
B. S3 Object Lambda
C. S3 Replication
D. S3 Glacier Flexible Retrieval
Correct answer: B. S3 Object Lambda
Explanation: S3 Object Lambda uses Lambda to modify the response to an S3 GetObject request. The other options do not provide request-time response transformation.
Question 5
A company configures an S3 Object Lambda access point for PII redaction. Some users can still retrieve the original unredacted objects. What is the most likely design issue?
Correct answer: Those users still have an allowed access path to the bucket or a standard S3 access point that bypasses the Object Lambda access point.
Explanation: Object Lambda transforms requests that use its endpoint. IAM policies, bucket policies, and access-point policies must prevent unauthorized consumers from bypassing that endpoint and reading the original objects directly.