Skip to main content

aws_cloudfront_origin_access_identity Resource

Use the aws_cloudfront_origin_access_identity InSpec audit resource to test properties of a single specific AWS CloudFront origin access identity.

An origin access identity is a special CloudFront user that you can associate with Amazon S3 origins, so that you can secure all or just some of your Amazon S3 content.

For additional information, including details on parameters and properties, see the AWS documentation on AWS CloudFront CloudFrontOriginAccessIdentity..

Installation

This resource is available in the Chef InSpec AWS resource pack.

See the Chef InSpec documentation on cloud platforms for information on configuring your AWS environment for InSpec and creating an InSpec profile that uses the InSpec AWS resource pack.

Syntax

Ensure that the identity exists.

describe aws_cloudfront_origin_access_identity(id: 'ID') do
  it { should exist }
end

Parameters

id (required)

The ID for the origin access identity.

Properties

id
The ID for the origin access identity.
s3_canonical_user_id
The Amazon S3 canonical user ID for the origin access identity, used when giving the origin access identity read permission to an object in Amazon S3.
cloud_front_origin_access_identity_config.caller_reference
A unique value (for example, a date-time stamp) that ensures that the request can’t be replayed.
cloud_front_origin_access_identity_config.comment
A comment to describe the origin access identity.

Examples

Test that an ID is available.

describe aws_cloudfront_origin_access_identity(id: 'ID') do
  its('id') { should eq 'ID' }
end

Test that an s3 canonical user ID is available.

describe aws_cloudfront_origin_access_identity(id: 'ID') do
    its('s3_canonical_user_id') { should eq 'S3_CANONICAL_USER_ID' }
end

Matchers

This InSpec audit resource has the following special matchers. For a full list of available matchers, please visit our Universal Matchers page.

The controls will pass if the get method returns at least one result.

exist

Use should to test that the entity exists.

describe aws_cloudfront_origin_access_identity(id: 'ID') do
  it { should exist }
end

Use should_not to test the entity does not exist.

describe aws_cloudfront_origin_access_identity(id: 'ID') do
  it { should_not exist }
end

be_available

Use should to check if the entity is available.

describe aws_cloudfront_origin_access_identity(id: 'ID') do
  it { should be_available }
end

AWS Permissions

Your Principal will need the CloudFront:Client:GetCloudFrontOriginAccessIdentityResult action with Effect set to Allow.

Edit this page on GitHub

Thank you for your feedback!

×









Search Results