When origin is S3 in cloudfront distribution cache policy, can't query string be used…
- User
When origin is S3 in cloudfront distribution cache policy, can't query string be used for cache?
- Assistant
Yes, you can use query strings for caching when your origin is an Amazon S3 bucket in a CloudFront distribution. To use query strings for caching, you need to configure your cache policy to forward and cache based on query strings.
To do this, follow these steps:
- Sign in to the AWS Management Console and open the CloudFront console at https://console.aws.amazon.com/cloudfront/.
- Choose the distribution for which you want to update the cache policy.
- Go to the "Behaviors" tab.
- Select the cache behavior that you want to update and click "Edit."
- In the "Cache and origin request settings" section, choose "Use a cache policy and origin request policy."
- For "Cache policy," you can either choose an existing cache policy that forwards and caches based on query strings or create a new one.
a. To create a new cache policy, click "Create a cache policy," and then enter a name and description for the policy. Under "Cache key settings," select "Include all query strings" or "Include specific query strings," depending on your use case. If you choose "Include specific query strings," you'll need to add the query strings you want to forward and cache based on. Save the cache policy. 7. After selecting or creating the cache policy, click "Yes, Edit" to save the updated cache behavior.
Now, your CloudFront distribution will forward and cache based on the query strings as specified in your cache policy. Keep in mind that caching based on query strings can increase the number of objects in your cache and may impact your cache hit ratio if not properly configured.
번역결과
예, 오리진이 CloudFront 배포의 Amazon S3 버킷인 경우 캐싱에 쿼리 문자열을 사용할 수 있습니다. 캐싱에 쿼리 문자열을 사용하려면 쿼리 문자열을 기반으로 전달 및 캐시하도록 캐시 정책을 구성해야 합니다. 이렇게 하려면 다음 단계를 따르십시오.- AWS Management Console에 로그인하고 https://console.aws.amazon.com/cloudfront/에서 CloudFront 콘솔을 엽니다.
- 캐시 정책을 업데이트하려는 배포를 선택합니다.
- "동작" 탭으로 이동합니다.
- 업데이트할 캐시 동작을 선택하고 "편집"을 클릭합니다.
- "캐시 및 오리진 요청 설정" 섹션에서 "캐시 정책 및 오리진 요청 정책 사용"을 선택합니다.
- "캐시 정책"의 경우 쿼리 문자열을 기반으로 전달 및 캐시하는 기존 캐시 정책을 선택하거나 새 정책을 생성할 수 있습니다. ㅏ. 새 캐시 정책을 만들려면 "캐시 정책 만들기"를 클릭한 다음 정책의 이름과 설명을 입력합니다. 사용 사례에 따라 '캐시 키 설정'에서 '모든 쿼리 문자열 포함' 또는 '특정 쿼리 문자열 포함'을 선택합니다. "특정 쿼리 문자열 포함"을 선택하면 전달하고 캐시할 쿼리 문자열을 추가해야 합니다. 캐시 정책을 저장합니다.
- 캐시 정책을 선택하거나 생성한 후 "예, 편집합니다"를 클릭하여 업데이트된 캐시 동작을 저장합니다. 이제 CloudFront 배포는 캐시 정책에 지정된 쿼리 문자열을 기반으로 전달하고 캐시합니다. 쿼리 문자열을 기반으로 하는 캐싱은 캐시의 개체 수를 증가시킬 수 있으며 적절하게 구성되지 않은 경우 캐시 적중률에 영향을 미칠 수 있습니다.
- User
오리진 유형이 S3인 경우, 쿼리 문자열을 캐시로 설정할 수 없어. 번역결과 If the origin type is S3, you cannot set the query string to cache.
- Assistant