# Time to Live

Time to Live is a limit on how long data remains valid, reusable, or retained before expiration handling applies.

Cloud concept. Updated 2026-10-29. Page: https://blowstack.com/tools/cloud-concepts-hub/time-to-live

> Time to Live (TTL) controls the lifetime of cached responses, DNS records, and other temporary data. Engineers use it to balance freshness, latency, backend load, and storage consumption, but expiration behavior depends on the system implementing it.

Practice exams covering Time to Live: [ANS-C01 AWS Certified Advanced Networking - Specialty](https://blowstack.com/practice-exams/aws-certified-advanced-networking-specialty), [SOA-C03 AWS Certified CloudOps Engineer - Associate](https://blowstack.com/practice-exams/aws-certified-cloudops-engineer-associate), [DVA-C02 AWS Certified Developer - Associate](https://blowstack.com/practice-exams/aws-certified-developer-associate), [SAA-C03 AWS Certified Solutions Architect - Associate](https://blowstack.com/practice-exams/aws-certified-solutions-architect-associate), [SAP-C03 AWS Certified Solutions Architect - Professional](https://blowstack.com/practice-exams/aws-certified-solutions-architect-professional).

## 6 key aspects of Time to Live

TTL defines expiration behavior and balances freshness against efficiency, but effective results depend on cache policies, independent layers, and refresh mechanisms.

1. **Explicit expiration semantics**: Determine whether TTL is a duration or an expiration timestamp and what event starts the lifetime. Document whether expiration means revalidation, loss of visibility, or eventual deletion.
2. **Freshness versus efficiency**: Longer lifetimes reduce backend requests but increase the potential duration of stale responses. Choose values according to how quickly consumers must observe changes, not just the desired cache hit ratio.
3. **Origin directives and cache policy limits**: HTTP freshness headers interact with cache-specific configuration. In CloudFront, inspect minimum, default, and maximum TTL values, especially a positive minimum that can override restrictive origin caching directives.
4. **Revalidation and early eviction**: An expired cached response may be revalidated rather than downloaded again. An unexpired response may also be evicted early, so TTL does not guarantee cache residency.
5. **Independent cache layers**: Browsers, CDN edges, DNS resolvers, and application caches maintain separate lifetimes. Clearing or changing one layer does not necessarily refresh the others.
6. **Operational refresh controls**: Use invalidation or versioned resource names when waiting for expiration is unacceptable. Check cached errors and cache-key correctness before concluding that the freshness interval alone caused the problem.

## Cloud services for Time to Live

Route 53 controls how long DNS resolvers reuse the address information that directs clients to an application. CloudFront separately controls reuse of HTTP responses, often using freshness metadata supplied by an S3 origin. An application behind the delivery layer can use ElastiCache to limit repeated backend reads, while DynamoDB TTL can clean up temporary records asynchronously. These lifetimes operate independently: DNS expiration does not refresh CDN content, CDN invalidation does not clear browser caches, and database expiration does not remove cached application results. Coordinate their settings around the application's freshness requirements and test each layer separately during troubleshooting.

- **[Amazon CloudFront](https://blowstack.com/tools/cloud-services-hub/amazon-cloudfront)**: CloudFront combines origin freshness headers with cache-policy minimum, default, and maximum TTL settings to control edge caching. Troubleshooting includes examining matching cache behaviors, cache keys, cached errors, and whether invalidation or versioned URLs are needed.
- **[Amazon S3](https://blowstack.com/tools/cloud-services-hub/amazon-s3)**: S3 objects can carry Cache-Control and Expires metadata that influence downstream browser and CDN freshness. Those headers do not delete the object from S3; object retention and lifecycle expiration are separate mechanisms.
- **[Amazon Route 53](https://blowstack.com/tools/cloud-services-hub/amazon-route-53)**: Route 53 DNS records use TTL to tell recursive resolvers how long they may cache answers. Lowering TTL before a planned DNS change can reduce transition delays, but previously cached answers retain their earlier lifetime.
- **[Amazon ElastiCache](https://blowstack.com/tools/cloud-services-hub/amazon-elasticache)**: ElastiCache engines support expiring cache entries to limit reuse of application data. Applications must tolerate misses caused by expiration or eviction and retrieve current values from the authoritative backend.
- **[Amazon DynamoDB](https://blowstack.com/tools/cloud-services-hub/amazon-dynamodb)**: DynamoDB TTL uses a designated numeric attribute containing a Unix epoch expiration time in seconds. Expired items are deleted asynchronously, typically within a few days, so applications requiring immediate expiration must check timestamps rather than rely on prompt physical deletion.

## Time to Live exam questions

Real practice exam questions on Time to Live, with the correct answer and its explanation.

### Question 1 (SOA-C03)

**Question:**

A company serves a public configuration document through Amazon CloudFront. Origin request volume remains high even when users repeatedly request the same URL. The origin returns Cache-Control: public, max-age=0, must-revalidate. The CloudFront cache policy has a minimum TTL of 0 seconds, a default TTL of 3,600 seconds, and a maximum TTL of 86,400 seconds. No request attributes create different cache keys.

The company wants CloudFront to consider newly fetched responses fresh for 600 seconds to reduce origin requests. Browsers must continue to revalidate cached responses before reusing them. Which change meets both requirements?

**Correct answer:** Change the origin header to Cache-Control: public, max-age=0, s-maxage=600, must-revalidate, and leave the cache policy unchanged.

**Explanation:** The s-maxage directive gives shared caches such as CloudFront a 600-second freshness lifetime and takes precedence over max-age for those caches. This value is within the policy's TTL bounds. Browsers ignore s-maxage, so max-age=0 and must-revalidate continue to require browser revalidation before reuse.

### Question 2 (SAP-C03)

**Question:**

A logistics company serves a large public routing-data file through Amazon CloudFront from an HTTPS origin in its data center. All viewers receive identical content at the same URL. Requests are frequent at edge locations worldwide, and outbound data transfer from the data center is expensive. The origin returns the complete file for every origin request and does not support conditional requests.

The origin currently returns Cache-Control: public, max-age=60. The CloudFront cache policy has a minimum TTL of 0 seconds, a default TTL of 60 seconds, and a maximum TTL of 60 seconds. No other response headers specify freshness.

During normal operation, CloudFront may reuse a cached response for up to 10 minutes without checking the origin. Browsers must not consider a response fresh for more than 1 minute. The company cannot change the file URL or use scheduled invalidations. The origin headers and CloudFront cache policy can be changed.

Which configuration will minimize repeated full-file transfers from the origin while meeting both freshness requirements?

**Correct answer:** Return Cache-Control: public, max-age=60, s-maxage=600. Set the CloudFront minimum TTL to 0 seconds, default TTL to 60 seconds, and maximum TTL to 600 seconds.

**Explanation:** The s-maxage directive gives shared caches such as CloudFront a 600-second freshness lifetime, while browsers use max-age=60. The CloudFront maximum TTL permits the full 600-second shared-cache lifetime. This maximizes permitted reuse at CloudFront and reduces full-file origin transfers without allowing browsers to consider responses fresh for more than 60 seconds.

### Question 3 (DVA-C02)

**Question:**

A developer is configuring caching for an Amazon API Gateway Regional REST API. The GET /prices method returns a public price list in the currency specified by the X-Currency request header. Each request also includes a unique X-Request-Id header for tracing. Both headers are declared as method request parameters and forwarded to the backend. No other request attributes affect the response.

The developer has provisioned an API Gateway stage cache and enabled caching for the method. Responses can be reused for 5 minutes. Requests with the same X-Currency value must reuse a cached response even when their X-Request-Id values differ, while requests for different currencies must not share cached responses.

Which configuration meets these requirements?

**Correct answer:** Select X-Currency as a cache key parameter for the method, exclude X-Request-Id from the cache key, and set the cache TTL to 300 seconds.

**Explanation:** API Gateway REST API caching can use method request headers as cache key parameters. Including X-Currency separates responses by currency, while excluding X-Request-Id allows requests for the same currency to share an entry. A 300-second TTL provides the permitted 5-minute reuse period.

### Question 4 (ANS-C01)

**Question:**

A company operates an internal application with primary and standby deployments at fixed private IPv4 addresses. A networking account owns a Route 53 private hosted zone containing non-alias A records configured for failover routing. The zone is associated with application VPCs in several AWS accounts. On-premises recursive DNS servers resolve the application name through Route 53 Resolver inbound endpoints.

The existing health-evaluation mechanism guarantees that Route 53 stops including the primary address in new authoritative answers within 30 seconds after a supported application failure. The standby remains healthy. Both failover records currently have a TTL of 300 seconds.

The company requires every DNS resolution performed 90 seconds or more after a primary failure to return the standby address. All resolvers and clients honor record TTLs, do not serve expired answers, and do not impose minimum cache lifetimes. Caches cannot be flushed, and existing application connections are outside the requirement. Any new TTL settings will have been fully effective long enough for previously cached answers to expire before a failure occurs.

Which change meets the requirement while using the longest possible positive-answer TTL consistent with the existing 30-second health-evaluation bound?

**Correct answer:** Set the TTL of both failover A records to 60 seconds and retain the existing health-evaluation configuration.

**Explanation:** Route 53 can continue returning the primary address for up to 30 seconds after failure. An answer cached near the end of that interval can remain valid for another 60 seconds. The combined bound is therefore 90 seconds. Any longer positive-answer TTL could exceed the requirement.

### Question 5 (SAA-C03)

**Question:**

A transportation company serves a public service-alert feed through Amazon CloudFront. All viewers receive the same response. Alerts can change at any time, and the origin returns Cache-Control: max-age=60, s-maxage=3600. The CloudFront cache policy has a minimum TTL of 0 seconds, a default TTL of 60 seconds, and a maximum TTL of 86,400 seconds.

The company discovers that edge locations continue serving old alerts for much longer than expected. During normal operation with a healthy origin, CloudFront must consider cached responses stale after no more than 5 minutes. Browser caching must remain limited to 60 seconds. The company wants the greatest possible edge cache reuse within these limits, without changing origin headers or issuing routine invalidations.

Which change should a solutions architect make?

**Correct answer:** Change the CloudFront cache policy's maximum TTL to 300 seconds. Retain the existing minimum and default TTL values.

**Explanation:** CloudFront uses s-maxage rather than max-age for shared-cache freshness, subject to the cache policy's limits. A maximum TTL of 300 seconds caps the origin's 3,600-second shared-cache lifetime at the longest permitted duration, maximizing reuse within the freshness requirement. Browsers continue using max-age=60.

## Practice Time to Live in a full exam

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

- [ANS-C01](https://blowstack.com/practice-exams/aws-certified-advanced-networking-specialty): 8 questions
- [SOA-C03](https://blowstack.com/practice-exams/aws-certified-cloudops-engineer-associate): 6 questions
- [DVA-C02](https://blowstack.com/practice-exams/aws-certified-developer-associate): 2 questions
- [SAA-C03](https://blowstack.com/practice-exams/aws-certified-solutions-architect-associate): 2 questions
- [SAP-C03](https://blowstack.com/practice-exams/aws-certified-solutions-architect-professional): 1 question

## What is Time to Live

Time to Live, usually abbreviated TTL, defines a lifetime for a piece of data. In caching, it commonly specifies how long a stored response can be reused without checking its source. Other systems express TTL as an expiration timestamp rather than a duration. Always identify what expires, when the lifetime begins, and what the system does after expiration. Expiration might trigger revalidation, make an entry unavailable, or schedule asynchronous deletion; these are different behaviors.

For cloud content delivery, TTL determines how long an edge cache can consider an object fresh. A long TTL reduces origin requests, improves response latency, and helps absorb traffic spikes. A short TTL makes updates visible sooner but increases origin traffic and can expose backend capacity problems. Content-addressed static files, such as application.a81f.js, can usually tolerate long cache lifetimes because a changed file receives a new URL. Frequently updated HTML or configuration documents generally need shorter lifetimes or explicit revalidation.

HTTP origins communicate freshness through response headers. Cache-Control: max-age=300 specifies a freshness lifetime of 300 seconds. Cache-Control: s-maxage=3600 gives shared caches, such as a CDN, a separate lifetime and takes precedence over max-age for those caches. Expires provides an absolute expiration time when an applicable Cache-Control freshness directive is absent. For example, max-age=60, s-maxage=600 allows a browser freshness lifetime of one minute while a shared cache can use ten minutes, subject to its configured policies.

Amazon CloudFront applies minimum, default, and maximum TTL settings through cache policies. The default applies when the origin supplies no applicable freshness information; the minimum and maximum constrain the lifetime CloudFront derives from origin headers. A critical troubleshooting detail is that a minimum TTL greater than zero causes CloudFront to cache content for at least that interval even when the origin sends no-cache, no-store, or private. For sensitive or user-specific responses, use a configuration that actually prevents inappropriate caching rather than assuming an origin header alone is sufficient.

Expiration does not necessarily mean that cached bytes are immediately deleted or that the next request downloads the entire object. A cache can revalidate a stale response using ETag or Last-Modified validators. If the origin returns 304 Not Modified, the existing representation can be reused with refreshed freshness information. Explicit stale-serving directives can also permit reuse after freshness expires. Conversely, a cache can evict an object before its TTL ends because of capacity management, so TTL is not a guaranteed residency period.

When troubleshooting stale content, inspect the viewer response and the origin response, including Cache-Control, Expires, Age, and CloudFront's X-Cache header. Verify which cache behavior and cache policy match the request. Check whether the cache key distinguishes required query strings, headers, or cookies: a short TTL cannot correct a key that combines different representations. Cached error responses also have expiration controls, so a fixed origin can still appear broken while an earlier error remains cached.

Updating an origin object does not automatically replace copies already cached at the edge or in browsers. For an urgent correction, use CDN invalidation or publish a new versioned URL. CloudFront invalidation does not clear browser caches, and lowering a configured TTL should not be treated as an immediate purge. Also distinguish freshness problems from connectivity failures: changing an object TTL does not repair routing, TLS, or origin access permissions.

The same lifetime principle appears in DNS caching, application caches, and database record expiration, but their guarantees differ. DNS TTL controls resolver reuse, whereas a database TTL feature may delete expired records asynchronously. The IP packet field also called TTL is different: in modern IP forwarding, it effectively limits router hops rather than defining a cache freshness duration.

## Learn Time to Live in lessons

4 short lessons on Time to Live in 3 certification courses.

- SOA-C03: Time to Live versus Cache Invalidation (Premium), https://app.blowstack.com/lessons/time-to-live-versus-cache-invalidation-soa-c03
- SAP-C03: Time to Live: edge-cache freshness lifetimes (Premium), https://app.blowstack.com/lessons/time-to-live-edge-cache-freshness-lifetimes-sap-c03
- SAA-C03: Time to Live: expiration semantics (Premium), https://app.blowstack.com/lessons/time-to-live-expiration-semantics-saa-c03
- SOA-C03: Time to Live: CloudFront cache freshness (Premium), https://app.blowstack.com/lessons/time-to-live-cloudfront-cache-freshness-soa-c03
