AWS not authorized to perform: cloudfront:ListDistributions

Error:

Failed to load distributions: User: arn:aws:iam:::user/ is not authorized to perform: cloudfront:ListDistributions because no identity-based policy allows the cloudfront:ListDistributions action

Solution: Create an IAM policy for accessing CloudFront resources

  • Go to IAM dashboard.
  • Select Users menu from the left hand side menu.
  • Select the user you want to provide the permission.
  • Select the permissions tab and click on Add Permissions button.
  • Click Create Policy link.
  • On Create Policy page, select the following things:
    • Select CloudFront service.
    • Ensure that the following permissions are selected: CreateDistribution, ListDistributions

  • Click Next, to review poilcy.
  • In the name field enter IAMAccessCloudFrontDistributionPolicy.
  • Click Create Policy button.
  • Next page will give you a success message that the polciy has been created.
  • Go back to the 3rd step (Select the user you want to provide the permission) and click Next: Permissions button .
  • In the Set permissions section, click Attach existing policies directly tab.
  • Check the IAMAccessCloudFrontDistributionPolicy policy.
  • Click next to attach IAMAccessCloudFrontDistributionPolicy policy to the user.
  • The user should be able to access the CloudFront distribution resources.