Study guide
Technical reference and lesson notes
Purpose of This Lesson
Serverless architecture allows teams to focus on application code and business logic while AWS manages the underlying infrastructure and platform maintenance. This lesson introduces the main AWS services used to build serverless applications, including AWS Lambda, Amazon API Gateway, and application integration services.
The central architectural idea is to compose managed services into an application with multiple layers rather than managing fleets of servers directly.
Key Concepts
What Serverless Means
In a serverless model, AWS operates the underlying infrastructure for the service. The customer generally does not provision or maintain EC2 instances, install operating system patches, or manage platform software.
Serverless does not mean that servers do not exist. It means that server management is abstracted away from the application owner.
Typical benefits include:
- Reduced infrastructure-management overhead
- Faster application development
- Automatic integration with other managed AWS services
- The ability to focus on code, APIs, events, and business workflows
- Easier composition of applications from independently managed services
AWS Lambda
AWS Lambda provides serverless compute in the form of functions. You supply code and configure how it is invoked; AWS handles the underlying execution infrastructure.
Lambda is commonly used for:
- Processing events from AWS services
- Implementing API-backed application logic
- Running asynchronous background tasks
- Connecting multiple managed services
- Building small, independently deployable application components
Lambda is particularly valuable when application work can be represented as discrete units of execution rather than as a continuously running server process.
Amazon API Gateway
Amazon API Gateway exposes application functionality through APIs. It can be used to connect clients to backend services such as Lambda.
The lesson highlights two API styles:
- REST APIs
- HTTP APIs
API Gateway forms the interface layer of a serverless application, while Lambda or another backend performs the application logic. This separation allows the API surface and compute implementation to evolve independently.
Application Integration Services
Serverless applications frequently consist of multiple components. AWS application integration services help those components communicate and coordinate.
Important categories include:
- Messaging: Decouple producers and consumers so components do not need to communicate directly.
- Notifications: Deliver messages or events to multiple interested subscribers.
- Orchestration: Coordinate multi-step workflows and service interactions.
- Event-driven integration: Trigger processing when something happens in another service or application.
The appropriate integration pattern depends on whether the application needs buffering, fan-out, workflow coordination, or simple request/response communication.
Layered Serverless Applications
A serverless application can be structured into multiple layers, for example:
- A client or application consumer
- An API layer using API Gateway
- Compute logic implemented with Lambda
- Integration components for messaging, notifications, or orchestration
- Other managed AWS services used by the workload
Because these services are designed to integrate, developers can build useful applications without managing a traditional application server tier.
Exam-Relevant Takeaways
- Serverless shifts responsibility for infrastructure provisioning and platform maintenance to AWS, but customers still manage application code, configuration, permissions, and architecture.
- AWS Lambda is serverless compute based on functions.
- Amazon API Gateway provides an API front end and supports REST APIs and HTTP APIs.
- Serverless architectures often combine several managed services rather than relying on one service alone.
- Application integration services are selected based on the communication requirement: messaging, notification, event handling, or workflow orchestration.
- A serverless design can separate the API layer, compute layer, and integration layer.
- The absence of server management does not eliminate the need for security, observability, error handling, or architectural planning.
Architecture Decision Guide
| Requirement | Suitable serverless approach | Architectural consideration |
|---|---|---|
| Execute discrete application code without managing servers | AWS Lambda | Organize work into functions and define appropriate invocation mechanisms |
| Expose backend functionality through an API | Amazon API Gateway with Lambda or another backend | Choose the API style and design a stable client-facing contract |
| Decouple application components | Messaging service | Producers and consumers can operate independently, improving flexibility |
| Send an event or notification to multiple subscribers | Notification or event-driven integration service | Consider fan-out, subscriber behavior, and delivery requirements |
| Coordinate several steps or services | Orchestration service | Model workflow sequencing, failures, retries, and state transitions |
| Build an application from multiple managed components | Composed serverless architecture | Define clear service boundaries and control permissions between components |
Common Exam Traps
- “Serverless means no servers exist.” Servers still run the service; AWS manages them on the customer’s behalf.
- “Serverless removes all operational responsibility.” You still own code quality, IAM permissions, configuration, monitoring, failure handling, and application design.
- “API Gateway is the compute layer.” API Gateway exposes and manages APIs; Lambda is a common serverless compute backend.
- “Every integration should be synchronous.” Messaging and event-driven patterns can decouple components and avoid requiring an immediate response.
- “One Lambda function should contain the entire application.” Serverless applications are often divided into independently deployable functions and supporting managed services.
- “All API types have identical characteristics.” REST APIs and HTTP APIs are distinct API Gateway options and should be evaluated against the application’s requirements.
Real-World Engineer Notes
- Start with the interaction model: request/response, asynchronous messaging, event notification, or multi-step workflow.
- Keep serverless components focused on a clear responsibility. This makes changes and integrations easier to manage.
- Treat API contracts as an important boundary between clients and backend implementation.
- Design failure behavior explicitly. Distributed serverless applications require decisions about retries, duplicate processing, timeouts, and error handling.
- Use least-privilege IAM policies for functions and service-to-service interactions.
- Serverless reduces infrastructure work, but the number of managed components can increase architectural complexity. Standardize naming, deployment, monitoring, and ownership practices.
Quick Reference Summary
- Serverless: AWS manages the underlying infrastructure and platform operations.
- AWS Lambda: Runs application code as functions without customer-managed servers.
- Amazon API Gateway: Provides REST and HTTP API front ends for backend services.
- Messaging: Decouples producers and consumers.
- Notifications: Distributes events or messages to subscribers.
- Orchestration: Coordinates multiple application steps or services.
- Core design pattern: Compose API, compute, integration, and other managed-service layers into a complete application.
Flashcards
- Q: What does serverless mean in AWS architecture?
A: AWS manages the underlying infrastructure and platform maintenance while the customer focuses on application code and configuration.
- Q: Does serverless mean that no servers are used?
A: No. Servers still run the service, but AWS manages them for the customer.
- Q: What is AWS Lambda used for?
A: Running application code as serverless functions in response to configured invocations or events.
- Q: What role does Amazon API Gateway play?
A: It exposes backend functionality through APIs, including REST APIs and HTTP APIs.
- Q: Which service commonly provides compute behind API Gateway?
A: AWS Lambda, although API Gateway can connect to other backend services as well.
- Q: Why use messaging between serverless components?
A: To decouple producers and consumers so they can operate more independently.
- Q: When is orchestration useful?
A: When an application must coordinate multiple steps, services, or workflow states.
- Q: What responsibilities remain with the customer in a serverless architecture?
A: Application code, configuration, permissions, API design, monitoring, error handling, and overall architecture.
- Q: What are the two API styles identified for API Gateway in this lesson?
A: REST APIs and HTTP APIs.
- Q: What is a common structure for a layered serverless application?
A: Client, API Gateway, Lambda or another backend, and integration services such as messaging, notifications, or orchestration.
Practice Questions
Question 1
A development team wants to run application logic without provisioning EC2 instances or maintaining operating system patches. The logic can be represented as independently invoked units of code. Which AWS service best fits this requirement?
- A. Amazon EC2
- B. AWS Lambda
- C. Amazon VPC
- D. Amazon API Gateway
Correct answer: B. AWS Lambda
Explanation: Lambda runs code as serverless functions while AWS manages the underlying execution infrastructure. API Gateway can expose the function through an API, but it is not the compute service itself.
Question 2
A company needs to expose backend application functionality to clients through an HTTP-based interface and wants a managed API front end. Which service should the architect select?
- A. Amazon API Gateway
- B. AWS Lambda only
- C. Amazon EC2 Auto Scaling
- D. AWS IAM
Correct answer: A. Amazon API Gateway
Explanation: API Gateway provides managed API endpoints, including REST APIs and HTTP APIs. Lambda may be used behind the API to implement the application logic.
Question 3
An architect is designing a serverless application with several independent components. A producer should be able to submit work without requiring the consumer to be immediately available. Which integration approach is most appropriate?
- A. Direct synchronous calls between every component
- B. Messaging-based decoupling
- C. Placing all logic in one function
- D. Exposing every component directly to public clients
Correct answer: B. Messaging-based decoupling
Explanation: Messaging allows producers and consumers to operate independently and is appropriate when immediate request/response communication is not required.
Question 4
A workflow must coordinate multiple application steps and services, including handling the sequence of operations. Which category of serverless integration service should the architect evaluate?
- A. Orchestration
- B. DNS hosting only
- C. API documentation only
- D. Compute instance placement
Correct answer: A. Orchestration
Explanation: Orchestration services coordinate multi-step workflows and service interactions. The architect should also consider failure handling, retries, and workflow state.
Question 5
Which statement best describes the customer’s responsibility in a serverless architecture?
- A. The customer must patch the host operating system for every function.
- B. The customer must provision the servers used by API Gateway.
- C. The customer remains responsible for code, configuration, permissions, and application behavior.
- D. AWS automatically designs the application’s integration pattern.
Correct answer: C. The customer remains responsible for code, configuration, permissions, and application behavior.
Explanation: Serverless removes much of the infrastructure-management burden, but it does not remove application ownership or architectural responsibility.