Bobcares

AWS S3 Bucket in Cloudflare | All about.

by | Jun 11, 2022

AWS S3 Bucket in Cloudflare are storage objects that contain information and clear metadata, similar to record organisers.

As part of our AWS support service, Bobcares responds to all inquiries, no matter how big or small.

Let’s look at the details of Cloudflare’s AWS S3 buckets.

Cloudflare AWS S3 buckets

Cloudflare AWS S3 buckets

 

AWS S3 buckets are open distributed storage resources that can be accessed through Amazon Web Services’ (AWS) Simple Storage Service (S3), which is an item storage service. Amazon S3 buckets, which are similar to record organisers, store objects that include data and clear metadata.

Step 1: Create a domain-based bucket.

To serve the bucket, the entire hostname must be used, so avoid using something that is already in use. For this, I’ll use static.bobcares_example.com.

Create a bucket with this domain’s name in S3, then select the existing bucket containing our images as the copy settings from bucket. For Step 2, we’ll want the bucket to be in the same area as the existing bucket.

Without Cloudflare, test the custom domain.

Load a test image image.jpg into the root of the bucket with public viewable permissions. CNAME the DNS entry for the hostname (static.bobcares_example.com) to the Amazon bucket’s endpoint. This is typically the bucket’s name plus the standard S3 URL, which includes the region.

Now go to http://static.bobcares_example.com/image.jpg to see if the test resource is available; make sure to use http rather than https because https will not work here. DNS propagation from the previous step may take some time.

Step 2: Copy all of the resources from the earlier bucket.

To copy all of the resources from the old bucket to the new, we’ll need to follow this guide. The guide is detailed enough to copy all of our resources to the new bucket, though if we have a very large bucket, we may run into problems.

Check to see if the expected resources are available at http://static.bobcares_example.com/old_image_path.jpg.

Step 3: Sign up and configure Cloudflare

This is the process of adding the domain to Cloudflare. Cloudflare provides instructions for this. Make sure any existing records are included in the onboarding list. The static.bobcares_example.com -> static.bobcares_example.com.s3.us-west-2.amazonaws.com entry should be there. CNAME, which was created in step 1.

Once this is done, make sure the DNS entry is in “orange cloud” mode, also known as proxied mode (and cached). Repeat step 2 but this time look for signs that the image is coming from Cloudflare servers. This will contain a Server: cloudflare header as well as a cf-cache-status header, which indicates whether we are retrieving from Cloudflare’s cache and saving bandwidth. Because the previous step required a DNS change to propagate, this may take some time.

At this point, we should be able to use https in requests, but if not, go to Cloudflare’s SSL/TLS > Edge Certificates tab and ensure that Universal SSL is enabled, or that another type of certificate is properly configured. Please keep in mind that our SSL mode in Cloudflare’s SSL/TLS tab must be “Full” or “Flexible.”

The image is encrypted between the user’s browser and Cloudflare, but not between Cloudflare and AWS. Furthermore, in “Full” or “Flexible” mode, all requests covered by this certificate would be vulnerable to a similar middle man attack. The method described here cannot serve images over https. So to accomplish this, we must first create a Cloudfront distribution.

Step 4: Change the image link references.

This relates to the original question. All image link references will need to be updated from the old S3 bucket to the new Cloudflare hostname, static.bobcares_example.com.

Step 5: Change the cache settings.

To save bandwidth, we may want to change the Cache settings. There are two primary methods for accomplishing this. So the Cache-Control header will be used by Cloudflare to determine how long to cache. These instructions can be used to update the S3 cache control header in bulk. Additionally, the Caching > Configuration > Browser Cache TTL option in Cloudflare allows us to override this header.

This effectively changes the value of Cache-Control: max-age to the larger of the two. A longer TTL not only keeps images cached in users’ browsers for longer, but it also keeps images in Cloudflare’s edge cache for longer, reducing load on our S3 bucket.

[Looking for a solution to another query? We are just a click away.]

Conclusion

To sum up, our Support team went over the details of Cloudflare AWS S3 buckets

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF