Cloud concept · Updated

REST - REST, or Representational State Transfer, is an architectural style for distributed systems that exposes resources through a uniform, stateless interface.

In short

REST separates clients from server implementations by defining how resources are identified, represented, and manipulated through a consistent interface, commonly using HTTP. In cloud architectures, it supports independently scalable API backends and interoperable clients, but resilience still requires deliberate timeout, retry, caching, and dependency design.

Cloud Concepts Hub →

7 key aspects of REST

REST combines resource-oriented interfaces, stateless requests, explicit caching, and architectural separation to support interoperable distributed applications.

01
Resource-oriented uniform interface

Identify resources with stable URIs and exchange representations using consistent method and status-code semantics. Keep database layout and backend implementation details out of the public contract.

02
Stateless requests

Each request carries the context necessary for processing without depending on a prior server-held client session. Durable resource state remains in storage, allowing healthy backend instances to handle requests interchangeably.

03
Client-server separation and layers

Clients depend on the API contract rather than a particular backend process. Gateways, proxies, and load balancers can sit between clients and implementations without changing the resource interface.

04
Explicit caching behavior

Responses communicate whether and how they can be cached. Configure expiration, validation, and cache keys carefully to avoid stale data or disclosure of one user's response to another.

05
Self-descriptive messages and hypermedia

Methods, media types, headers, and representations explain how messages should be interpreted. In the full REST style, representations also provide links or controls that guide clients to available next actions.

06
Safe and idempotent operation semantics

Use safe methods for retrieval and preserve the intended idempotence of methods such as PUT and DELETE. Add application-level deduplication when retrying operations such as POST-based order creation.

07
Optional code on demand

REST permits a server to extend client behavior by delivering executable code, such as browser scripts. This constraint is optional and is usually not part of machine-to-machine cloud API design.

Cloud services for REST

Amazon API Gateway provides the managed API boundary, while AWS Lambda or Amazon ECS implements resource operations and accesses durable application storage. Amazon CloudFront can cache suitable responses near clients when cache keys and authorization boundaries are correctly configured. For work that should not hold an HTTP connection open, the API can enqueue a task in Amazon SQS and return a status-resource URI. These services support a layered design, but application contracts still determine method semantics, idempotency, resource authorization, and compatibility. Stateless handlers and asynchronous processing reduce backend coupling; timeouts, bounded retries, and capacity controls remain necessary for resilience.

Amazon API GatewayAmazon API Gateway

Provides managed API endpoints with routing, authorization integration, throttling, and monitoring. Its REST API and HTTP API product types have different capabilities, so choose based on requirements rather than the architectural label alone.

AWS LambdaAWS Lambda

Runs request-handling business logic behind API Gateway without requiring server management. Keep durable resource state outside the execution environment and make write operations resilient to client retries.

Amazon CloudFrontAmazon CloudFront

Can act as an edge-facing layer for HTTP APIs and cache eligible responses to reduce origin traffic and latency. Cache policies must account for relevant headers, cookies, and query strings, especially when responses vary by identity.

REST exam questions

Real practice exam questions on REST, with the correct answer and its explanation. Answer them with every option in the exam simulator.

DEA-C01

An AWS Lambda function runs hourly to ingest a supplier's complete product catalog into a data lake. The catalog is retrieved from a resource URI over HTTPS and changes only a few times each week. Each successful retrieval returns the complete JSON representation and an ETag header. The supplier supports standard HTTP conditional requests but provides no guarantee that a cached representation remains fresh for any fixed duration.

The pipeline durably stores the last successfully ingested representation and its ETag. Each run must validate the catalog with the supplier and ingest a new representation if it has changed. The engineer must minimize response-body data transfer when the catalog is unchanged.

Which request and response-handling strategy meets these requirements?

Show answerCORRECT ANSWER

Send a GET request with If-None-Match set to the stored ETag. On HTTP 304, retain the stored representation. On HTTP 200, ingest the returned representation and save its ETag after successful ingestion.

If-None-Match enables conditional retrieval. When the validator matches, HTTP 304 confirms that the stored representation can be reused without transferring the catalog body. When it does not match, HTTP 200 supplies the current representation. Saving the new ETag only after successful ingestion keeps the validator aligned with the ingested data.

DVA-C02

A developer is adding a device-configuration endpoint to an Amazon API Gateway REST API backed by AWS Lambda. Each device has a client-known device ID and exactly one current configuration. Clients submit the complete desired configuration; settings omitted from the request must be removed from the stored configuration. If a response is lost, a client can resend the identical request, and the retry must not create another configuration or apply additional changes. The endpoint must follow resource-oriented HTTP method semantics.

Which API and handler design meets these requirements?

Show answerCORRECT ANSWER

Expose PUT /devices/{deviceId}/configuration. Have the Lambda handler atomically create or replace the configuration at that device's stable identifier with exactly the submitted settings.

PUT expresses creation or complete replacement at a client-known resource URI. Replacing the configuration with exactly the submitted representation removes omitted settings. Repeating that replacement has the same intended effect without creating additional configurations.

SAA-C03

A company exposes a device-management API through Amazon API Gateway. Each device has a stable identifier and one configuration document in a durable data store. Administrators submit the complete desired configuration, and settings omitted from a submission must be removed from the stored configuration. Clients sometimes time out after the backend commits an update and must retry without knowing whether the first request succeeded. Repeating a submission must not create additional configuration records or change the final configuration.

Which API design meets these requirements?

Show answerCORRECT ANSWER

Expose PUT /devices/{deviceId}/configuration. Have the backend atomically replace the document stored under the stable device identifier with the complete submitted document.

PUT expresses replacement of the resource at a known URI. Replacing the document under the same durable key removes omitted settings and makes identical retries produce the same intended stored state without creating additional records.

Practice REST in a full exam

Questions on REST in each practice exam, with every answer option and an explanation for each:

Start a free practice exam

What is REST

3 min read

REST stands for Representational State Transfer. It is an architectural style rather than a protocol, product, or API specification. A resource represents something the application exposes, such as an order, customer, or deployment, and has an identifier such as /orders/123. Clients exchange representations of that resource, often JSON, rather than accessing its internal database structures directly. REST does not require JSON, and an HTTP endpoint is not automatically RESTful.

REST defines client-server separation, stateless interactions, cache constraints, a uniform interface, a layered system, and optional code on demand. Its uniform interface includes resource identification, manipulation through representations, self-descriptive messages, and hypermedia links that guide application transitions. Many production APIs described as REST implement resource-oriented HTTP interfaces without fully implementing hypermedia. Distinguishing the architectural style from common industry shorthand helps avoid treating every JSON API as a complete REST implementation.

In HTTP-based designs, methods communicate operation semantics. GET retrieves a representation without requesting a state change, POST commonly creates a resource or submits processing, PUT creates or replaces the state at a target URI, and DELETE removes the association between a URI and its current functionality. PATCH applies a partial modification. GET is safe and idempotent; PUT and DELETE are idempotent but not safe. Idempotence means repeating the same request has the same intended server-side effect, not that every response must be identical. POST and PATCH are not inherently idempotent.

Statelessness means each request contains the information needed to understand it without relying on server-held client session context from earlier requests. It does not mean the application has no database or persistent resource state. For example, any healthy backend instance can process an authenticated request for /orders/123 by validating its credentials and reading shared durable storage. This reduces dependence on sticky sessions and makes horizontal scaling and instance replacement easier.

In the cloud, an API gateway can provide a managed entry point for routing, authentication integration, throttling, and observability, while functions or containers implement business logic. Amazon API Gateway offers REST APIs and HTTP APIs as distinct product types; either can expose a resource-oriented HTTP interface. Choose between them by required features rather than assuming that a RESTful design requires the product named REST API. API Gateway REST APIs support capabilities such as request validation, usage plans, and stage caching. API keys identify consumers for usage plans; they are not a substitute for authentication and authorization.

REST does not automatically make services loosely coupled or resilient. A synchronous chain of APIs can still propagate latency and failures. Configure bounded timeouts, retry transient failures with exponential backoff and jitter, and avoid blindly retrying non-idempotent operations. For order creation, an application-enforced idempotency key can prevent duplicate orders after a lost response. For long-running work, an API can return HTTP 202 with a status-resource location and process the work asynchronously through a queue.

Caching can reduce latency and backend load, but cache keys and expiration must reflect query parameters, authorization boundaries, and acceptable staleness. Use HTTP cache directives and validators such as ETags where appropriate. Protect traffic with HTTPS, authorize access to individual resources, and preserve compatible API contracts as implementations evolve. REST provides broadly interoperable request-response interfaces, but large resource graphs may require many round trips, and continuous bidirectional communication may be better served by a different interaction model.

Learn REST in lessons

2 short lessons on REST in 2 certification courses.

Open the lessons