Skip to content

Commit 8ba2e60

Browse files
committed
add example of ttl cloudfront caching
1 parent 8a9e104 commit 8ba2e60

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

EXAMPLE.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,34 @@ module "cloudfront" {
6464
}
6565
]
6666
}
67+
```
68+
69+
## Cloudfront distribution with s3 Origin with TTL value
70+
```
71+
module "cloudfront" {
72+
source = "./cloudfront"
73+
origin = {
74+
domain_name = "s3_bucket_regional_domain_name"
75+
origin_id = "s3_bucket_name"
76+
77+
## We can only use Any one of Origin Access Control or Origin Access Identity
78+
# For Origin Access Control
79+
origin_access_control_id = "s3_cloudfront_origin_access_control_id"
80+
# For Origin Access Identity
81+
s3_origin_config = {
82+
s3_origin_access_identity = "s3_cloudfront_origin_access_identity_path"
83+
}
84+
85+
}
86+
domain_aliases = ["example.com", "www.example.com"]
87+
acm_arn = "acm_arn"
88+
89+
## TTL(Time to Live) is the time in seconds that an object is in Cloudfront Cache.
90+
# If we pass these below values then it will be overwritten by default values.
91+
ttl_values = {
92+
min_ttl = 1 # min amount of time that you want objects to stay in cloudfront cache before it sends another request to origin
93+
max_ttl = 86900 # max amount of time that you want objects to stay in cloudfront cache before it sends another request to origin
94+
default_ttl = 3500 # default amount of time that you want objects to stay in cloudfront cache before it sends another request to origin
95+
}
96+
}
6797
```

0 commit comments

Comments
 (0)