How to Prevent Hotlinking on Amazon S3 Storage

October 11, 2011 | By Regaz.

It you try to Googling around you will find than at this time is not easy to Catching Up this Solution…
Sometime get Complicate to get some Big Fish on the WWW… But some time get Easy ;)
This will work on Every Os: Linux, Windows, macOS X and even in Unix :))

  1. Login in the Amazon AWS Console
    Select Amazon S3 from Drop Down list Click “Sign in the AWS Console”
    Insert your Credentials

  2. Amazon S3 > Properties > Edit Bucket policy
    Insert: (Substitute only YOUR-BUCKET-NAME and your-domain-name)

    {
    "Version":"2008-10-17",
    "Id":"",
    "Statement":[{
    "Sid":"Allow in my domains",
    "Effect":"Allow",
    "Principal":{
    "AWS":"*"
    },
    "Action":"s3:GetObject",
    "Resource":"arn:aws:s3:::YOUR-BUCKET-NAME/*",
    "Condition":{
    "StringLike":{
    "aws:Referer":["http://your-domain-name/*",
    "http://www.your-domain-name/*"
    ]
    }
    }
    },
    {
    "Sid":"Give not access if referer is no my sites",
    "Effect":"Deny",
    "Principal":{
    "AWS":"*"
    },
    "Action":"s3:GetObject",
    "Resource":"arn:aws:s3:::YOUR-BUCKET-NAME/*",
    "Condition":{
    "StringNotLike":{
    "aws:Referer":["http://your-domain-name/*",
    "http://www.your-domain-name/*"
    ]
    }
    }
    }
    ]
    }

    Save

  3. Test Properly If the Bucket Policy Effectively and Definitely Prevent Hotlinking
    Herein:
    Joomla Website Development
    Amazon AWS S3, Amazon AWS S3 Buckup, Amazon AWS Cloud

    Drupal Website Development


QuickChic Theme • Powered by WordPress