steampipe plugin install aws

Table: aws_cloudfront_cache_policy - Query AWS CloudFront Cache Policies using SQL

The AWS CloudFront Cache Policy is a feature of AWS CloudFront that allows you to specify detailed cache behaviors, including how, when, and where CloudFront caches and delivers content. It provides control over the data that CloudFront uses to serve requests, including headers, cookies, and query strings. This policy aids in optimizing the cache key and improving the cache hit ratio, thereby enhancing the performance of your application.

Table Usage Guide

The aws_cloudfront_cache_policy table in Steampipe provides you with information about Cache Policies within AWS CloudFront. This table allows you, as a DevOps engineer, to query policy-specific details, including the configuration, status, and associated metadata. You can utilize this table to gather insights on cache policies, such as their identifiers, comment descriptions, the default time to live (TTL), maximum and minimum TTL, and more. The schema outlines the various attributes of the cache policy for you, including the policy ARN, creation time, last modified time, and associated tags.

Examples

Basic info

Explore which AWS CloudFront cache policies are in place to understand their impact on content delivery and caching strategies. This can be beneficial in optimizing resource usage and reducing costs.

select
id,
name,
comment,
min_ttl,
etag,
last_modified_time
from
aws_cloudfront_cache_policy;
select
id,
name,
comment,
min_ttl,
etag,
last_modified_time
from
aws_cloudfront_cache_policy;

List cache policies where Gzip compression format is not enabled

Identify instances where Gzip compression format is not enabled in AWS CloudFront cache policies. This can help to optimize content delivery and improve website loading speeds.

select
id,
name,
parameters_in_cache_key_and_forwarded_to_origin ->> 'EnableAcceptEncodingGzip' as enable_gzip
from
aws_cloudfront_cache_policy
where
parameters_in_cache_key_and_forwarded_to_origin ->> 'EnableAcceptEncodingGzip' <> 'true';
select
id,
name,
json_extract(
parameters_in_cache_key_and_forwarded_to_origin,
'$.EnableAcceptEncodingGzip'
) as enable_gzip
from
aws_cloudfront_cache_policy
where
json_extract(
parameters_in_cache_key_and_forwarded_to_origin,
'$.EnableAcceptEncodingGzip'
) <> 'true';

List cache policies where Brotli compression format is not enabled

Identify instances where Brotli compression format is not enabled in cache policies. This could help improve website performance by enabling more efficient data compression.

select
id,
name,
parameters_in_cache_key_and_forwarded_to_origin ->> 'EnableAcceptEncodingBrotli' as enable_brotli
from
aws_cloudfront_cache_policy
where
parameters_in_cache_key_and_forwarded_to_origin ->> 'EnableAcceptEncodingBrotli' <> 'true';
select
id,
name,
json_extract(
parameters_in_cache_key_and_forwarded_to_origin,
'$.EnableAcceptEncodingBrotli'
) as enable_brotli
from
aws_cloudfront_cache_policy
where
json_extract(
parameters_in_cache_key_and_forwarded_to_origin,
'$.EnableAcceptEncodingBrotli'
) <> 'true';

Schema for aws_cloudfront_cache_policy

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form.
account_idtext=, !=, ~~, ~~*, !~~, !~~*The AWS Account ID in which the resource is located.
akasjsonbArray of globally unique identifier strings (also known as) for the resource.
commenttextA comment to describe the cache policy.
default_ttlbigintThe default amount of time, in seconds, that you want objects to stay in the CloudFront cache before CloudFront sends another request to the origin to see if the object has been updated.
etagtextThe current version of the cache policy.
idtext=The unique identifier for the cache policy.
last_modified_timetimestamp with time zoneThe date and time when the cache policy was last modified.
max_ttlbigintThe maximum amount of time, in seconds, that you want objects to stay in the CloudFront cache before CloudFront sends another request to the origin to see if the object has been updated.
min_ttlbigintThe minimum amount of time, in seconds, that you want objects to stay in the CloudFront cache before CloudFront sends another request to the origin to see if the object has been updated.
nametextA unique name to identify the cache policy.
parameters_in_cache_key_and_forwarded_to_originjsonbThe HTTP headers, cookies, and URL query strings to include in the cache key. The values included in the cache key are automatically included in requests that CloudFront sends to the origin.
partitiontextThe AWS partition in which the resource is located (aws, aws-cn, or aws-us-gov).
regiontextThe AWS Region in which the resource is located.
sp_connection_nametext=, !=, ~~, ~~*, !~~, !~~*Steampipe connection name.
sp_ctxjsonbSteampipe context in JSON form.
titletextTitle of the resource.

Export

This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.

You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh script:

/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- aws

You can pass the configuration to the command with the --config argument:

steampipe_export_aws --config '<your_config>' aws_cloudfront_cache_policy