04 - Resource

 

目錄

  • CloudFront

 


CloudFront

 

建立的時間

CloudFront distributions take about 15 minutes to reach a deployed state after creation or modification.
 During this time, deletes to resources will be blocked.
 If you need to delete a distribution that is enabled and you do not want to wait,
 you need to use the retain_on_delete flag.

path_pattern

can only contain these characters: [a-zA-Z0-9_-.*$/~"'&@:?+\].

price_class

PriceClass_All,
PriceClass_200 # 沒有 South America, Australia and New Zealand(新西蘭, Australia 旁邊)
PriceClass_100 # 只有 North America (United States, Mexico, Canada), Europe and Israel

viewer_protocol_policy (Required)

allow-all, https-only, or redirect-to-https

viewer_certificate

iam_certificate_id. The ACM certificate must be in US-EAST-1.
# vip causes CloudFront to use a dedicated IP address and may incur extra charges.
ssl_support_method  = "sni-only"

restrictions

At least 1 "restrictions" blocks are required.

 


cache_policy_id vs inline settings

 

cache_policy_id - (Optional)

# AWS Managed Caching Policy

CachingDisabled "4135ea2d-6df8-44a3-9df3-4b5a84be39ad"

  • Minimum TTL: 0 seconds
  • Maximum TTL: 0 seconds
  • Default TTL: 0 seconds
  • Headers included in the cache key: None
  • Cookies included in the cache key: None
  • Query strings included in the cache key: None
  • Cache compressed objects setting: Disabled

CachingOptimized "658327ea-f89d-4fab-a63d-7e88639e58f6"

  • Minimum TTL: 1 second.
  • Maximum TTL: 31,536,000 seconds (365 days).
  • Default TTL: 86,400 seconds (24 hours).
  • Headers included in the cache key: None are explicitly included.
  • "Accept-Encoding" header is included because the cache compressed objects setting is enabled
  • Cookies included in the cache key: None.
  • Query strings included in the cache key: None.
  • Cache compressed objects setting: Enabled.

inline settings

如果不用 cache_policy_id 就要用 forwarded_values

forwarded_values {
  query_string = false
  cookies {
    forward = "none"
  }
}

min_ttl  (Optional)
Defaults to 0 seconds

max_ttl  (Optional)
Only effective in the presence of Cache-Control max-age, Cache-Control s-maxage, and Expires headers.

default_ttl (Optional)
request in the absence of an Cache-Control max-age or Expires header.

compress (Optional)
Whether you want CloudFront to automatically compress content for web requests
 that include Accept-Encoding: gzip in the request header (default: false).

 

 

Creative Commons license icon Creative Commons license icon