blog

Hosting AWS Cloudfront using Origin Access Identity (OAI) vs Origin Access Control (OAC)

Learn what the difference is between the 2 approaches and why is it important to know the difference

Both Origin Access Identity (OAI) and Origin Access Control (OAC) are mechanisms to enhance the security of CloudFront distributions by controlling access to the origin servers. However, they offer distinct approaches and features:

Origin Access Identity (OAI)

  • IAM-based Authentication: OAI uses an Identity and Access Management (IAM) Identity to grant CloudFront access to the origin.
  • Per-Distribution Control: OAI grants access at the CloudFront distribution level, making it easy to manage access for multiple origins.
  • Granular Permissions: OAI allows you to specify specific IAM users or roles who have permission to access the origin.
  • No Additional Configuration on Origin: OAI does not require any additional configuration on the origin server.
  • Higher Security: OAI provides a higher level of security because the IAM Identity must be explicitly granted access to the origin.

Origin Access Control (OAC)

  • Origin-based Authentication: OAC uses an Origin Access Control List (OACL) on the origin server to grant access to CloudFront.
  • Per-Origin Control: OAC grants access at the origin server level, providing fine-grained control over which CloudFront distributions can access the origin.
  • No IAM Integration: OAC does not involve IAM and relies solely on the OACL configured on the origin server.
  • Additional Configuration on Origin: OAC requires the origin server to be configured to accept the Signed URL or Signed Cookie generated by CloudFront.
  • Lower Security: OAC is less secure than OAI because the OACL can be modified by anyone with access to the origin server.

Recommendations

  • Use OAI for:
    • When you need a highly secure solution with granular access control.
    • When you have multiple origins and want to manage access centrally.
  • Use OAC for:
    • When you prefer origin-based control and do not require IAM integration.
    • When the origin server is not managed by AWS or does not support signed URL/cookie authentication.