Bunny CDN provides a fast and easy way to speed up your Backblaze B2 bucket, as well as save thousands of dollars on bandwidth costs. This guide will show you how to setup Bunny CDN in 3 easy steps. If you don't already have a Backblaze B2 account, create one for free here.
1. Create a Private Backblaze B2 Bucket
If you already have a Private B2 Bucket created and have some data inside it, you can skip this step. If not, log in to Backblaze and click on "Create a Bucket" and follow the below instructions. Ensure that your B2 bucket is set to the "Private" mode to keep your content secure when being served to users.
After you have clicked "Create a Bucket", you will be met with various settings to configure prior to creation. The first two options will allow you to specify the name of the bucket, and private or public mode. Please ensure you set the "Private" mode. Default Encryption/Object Lock is an end-user decision however for the purpose of this tutorial, we will leave it on the default settings.
2. Create your S3 App Key, used for authentication with Bunny CDN
To authenticate with a B2 bucket securely, we recommend that users make use of the AWS S3 authentication system. This is an industry standard for secure and reliable management/authentication with object storage systems and is the recommended way to connect your bucket with Bunny CDN.
Select "App Keys" on the left hand side of the Backblaze dashboard.
After this, you will be greeted with a page detailing your Master Application key among other things. Please click the "Add a New Application Key" at the bottom of the page.
Following this, the "Add Application Key" will appear. This is where you will specify the configuration of the keys, and what permissions they have. You need to select the private bucket that you created in Step 1 and also ensure that "Allow List All Bucket Names" is checked.
Once you have selected these, please press "Create New Key". You will then be redirected to a successful creation page that has a lot of information. You need to save "keyID" and "applicationKey" to somewhere safe for a future step in the tutorial.
3. Identify your S3 Bucket URL
Leading up to this step, you will have created a private Backblaze B2 bucket and created the necessary application keys used for S3 based authentication between platforms. You now need to locate your S3 URL that will be used in the creation of your Bunny CDN Pull Zone.
Please press "Browse Files" and upload a test file if you do not already have one. Once completed, press the (i) tooltip marked in step 2 of the below screenshot.
You will find then various details regarding the file that you have completed uploading. Please focus on the "S3 URL" option and save this URL excluding the file name for a later step. For example, our test bucket is called "bunnytestbucket" so you would be looking to save "https://bunnytestbucket.s3.eu-central-003.backblazeb2.com"
3. Creating or re-configuring your Bunny CDN Pull Zone
Now that you have identified your secure S3 authentication URL, you can use this to configure your Pull Zone. Log into bunny.net and navigate to the "Add Pull Zone" page.
First, select a name for your Pull Zone (bear in mind, this will also become your Bunny CDN hostname for your zone) and paste the S3 URL located in step 5 into the "Origin URL" section. The Host Header will be automatically generated and does not need to be changed.
Similarly, if you are looking to modify an existing pull zone, you can do the same thing such as below:
For more detailed instructions, you can have a look at our article on creating your first pull zone.
5. Securing your connection to the B2 origin using S3 authentication
In our final step, we will configure your new Pull Zone to authenticate with your B2 bucket using S3 Authentication. The "App Keys" previously generated will now be used.
Please go to the "S3 Authentication" section of our Security configuration options and enable it using the "Enable AWS S3 Authentication" button. You will now need to fill in the following details:
AWS Key: Your B2 keyID
AWS Secret: Your B2 applicationKey
AWS Region Name: The B2 hostname
These were generated previously at the last part in Step 2 of this tutorial. A step by step screenshot can be found below:
Once completed, you can then click 'SAVE AWS CONFIGURATION".
6. Congratulations! Let's now test your new zone
Providing all steps have been followed, you should now have configured a B2 bucket in "Private" mode, ensuring that your files are protected by S3 authentication and also sped up by the Bunny CDN platform.
In our test, our pull zone name was "https://bunnytestwordpress.b-cdn.net" and our file name was "code-to-share.js". If everything was correctly set up, we should now see our test file and the contents of it on our browser.
In your application, you can now simply replace your existing URLs with the new CDN URL and enjoy much faster speeds and lower traffic costs.