Other Articles
- IAM - Enable User MFA
- IAM - Enforce Key Rotation
- IAM - Enforce Active Key Limit
- IAM - Disable Unused User Credentials
- IAM - Enforce Group Permission
- IAM - Enforce Password Length
- IAM - Prohibit Password Reuse
- IAM - Check Root Access Keys Existence
- IAM - Enable Root MFA
- IAM - Establish Support Role
- IAM - Enable Key Rotation
- Purge Expired Certificates
- EC2 Volume – Enable EBS Volume Backup
- EC2 Volume – Enable EBS Encryption
- EFS – Enable EFS Storage Backup
- S3 Bucket – Enable S3 Bucket Versioning
- S3 Bucket – Enable S3 Bucket Encryption
- S3 Bucket – Block S3 Bucket Public Access
- RDS DB Instance – Encryption of Storage
- RDS DB Instance – Enable Deletion Protection
- RDS DB Instance – Enable Auto Minor Version Upgrade
- DynamoDB Table – Enable Table Encryption
- DynamoDB Table – Enable Table Point In Time Recovery
- DynamoDB Table – Enable Table Deletion Protection
- EKS Cluster – Enable Secrets Encryption
- OpenSearch Domain – Enable Encryption at Rest
- RDS DB Cluster – Retain Backups for 7 Days
- RDS DB Cluster – Encryption of Storage
- RDS DB Cluster – Enable Deletion Protection
- EC2 Instance – Monitor CPU Utilization
- ECS Service – Monitor CPU Utilization
- ECS Service – Monitor Memory Utilization
- RDS DB Instance – Monitor Free Storage Space
- RDS DB Instance – Monitor CPU Utilization
- SQS Queue – Monitor Message Age
- SQS Queue – Monitor Message Visibility
- DynamoDB Table – Monitor Table Read Capacity
- DynamoDB Table – Monitor Table Write Capacity
- DynamoDB Table – Monitor Table Latency
- Enable CloudTrail
- Encrypt CloudTrail Logs
- EC2 VPC – Ensure Flow Logs are Enabled
- EKS Cluster – Enable Control Plane Logging
- CloudWatch Log Group – Enable KMS Encryption
- CloudWatch Log Group – Configure Retention
- Load Balancer – Enable Access Logs
- RDS DB Instance – Block Public Access
- EC2 Security Group – Restrict Public SSH and RDP Access
- EC2 Security Group – Restrict Public Database Access
- EKS Cluster – Restrict Public Endpoint
- EC2 VPC – Restrict Default Security Group Traffic
- Load Balancer – Redirect HTTP Traffic to HTTPS
- Load Balancer – Use Strong TLS Policies
- OpenSearch Domain – Enable Node-to-Node Encryption
- OpenSearch Domain – Enforce HTTPS
- OpenSearch Domain – Restrict Public Access
- RDS DB Cluster – Block Public Access
- EC2 Instance – Enable Deletion Protection
- ECS Service – Enable Auto Scaling
- Load Balancer – Enable Deletion Protection
- Enable AWS Security Hub
- Enable GuardDuty
- CloudFront Distribution – Require TLS 1.2 for Viewers
- CloudFront Distribution – Associate a WAF Web ACL
- CloudFront Distribution – Protect S3 Origin Access
- KMS Key – Avoid Pending Deletion
- SNS Topic – Enable Encryption
- SNS Topic – Restrict Topic Policy Access
CloudFront Distribution – Enforce HTTPS for Viewers
Secure Configuration Checks > AWS
This check ensures that every CloudFront cache behavior redirects HTTP viewers to HTTPS or rejects HTTP. Enforcing HTTPS protects data in transit from interception and tampering.
Check Details
- Resource: CloudFront Distribution
- Check: Enforce HTTPS for CloudFront viewers (
ViewerHttpsOnly) - Risk: Data sent over plain HTTP can be intercepted or modified
Which policy should I choose?
-
Redirect HTTP to HTTPS (
redirect-to-https): HTTP requests are redirected to HTTPS. Best for websites, because existing links keep working. -
HTTPS only (
https-only): HTTP requests are rejected with an HTTP 403 error. Best for APIs and clients that never need HTTP.
Remediation via AWS Console
-
Log in to the AWS Management Console and open the Amazon CloudFront console.
- Navigate to Distributions in the left navigation pane and select the affected distribution.
-
Open the Behaviors tab.
- Select the cache behavior you want to update and click Edit.
-
Under Viewer protocol policy, select either:
- Redirect HTTP to HTTPS: Automatically redirects HTTP requests to HTTPS.
- HTTPS only: Allows only HTTPS requests and returns HTTP 403 Forbidden for HTTP requests.
- Click Save changes.
- Repeat steps 4 to 6 for every cache behavior, including the Default (*) behavior. All behaviors must enforce HTTPS.
- Wait for the distribution deployment to complete and verify that no cache behavior allows both HTTP and HTTPS.
Remediation via AWS CLI
-
Log in to the AWS Management Console and click the CloudShell icon (
>_) in the top-right corner.
-
Download the current distribution configuration:
aws cloudfront get-distribution-config \ --id <distribution-id> > dist-config.json
-
Set the policy on all behaviors. Use
https-onlyinstead to reject HTTP:POLICY="redirect-to-https" ETAG=$(jq -r '.ETag' dist-config.json) jq --arg p "$POLICY" '.DistributionConfig | .DefaultCacheBehavior.ViewerProtocolPolicy = $p | .CacheBehaviors.Items |= (if . then map(.ViewerProtocolPolicy = $p) else . end)' \ dist-config.json > updated-config.json
-
Apply the updated configuration:
aws cloudfront update-distribution \ --id <distribution-id> \ --if-match "$ETAG" \ --distribution-config file://updated-config.json
-
Verify the policy. No
allow-allshould appear:aws cloudfront get-distribution-config \ --id <distribution-id> \ --query '[DistributionConfig.DefaultCacheBehavior.ViewerProtocolPolicy, DistributionConfig.CacheBehaviors.Items[].ViewerProtocolPolicy]'
Replace <distribution-id> with your distribution ID, for example E1ABCDEF234567.
CloudFront is global, so CloudShell works in any region.
Updated on 03 November, 2026