Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Amazon S3 Essentials

You're reading from   Amazon S3 Essentials Get started with Amazon S3 for virtually unlimited cloud and Internet storage

Arrow left icon
Product type Paperback
Published in Nov 2015
Publisher Packt
ISBN-13 9781783554898
Length 112 pages
Edition 1st Edition
Arrow right icon
Author (1):
Arrow left icon
Sunil Gulabani Sunil Gulabani
Author Profile Icon Sunil Gulabani
Sunil Gulabani
Arrow right icon
View More author details
Toc

Website configuration using the Amazon S3 Java SDK


In previous chapters, we saw how to create a bucket and upload objects (files) to the bucket. Here, we will take a look at how we can create a new bucket, upload index.html and error.html files, and configure the website for the bucket.

To set the bucket website configuration, we have a method in Amazon S3, as follows:

s3.setBucketWebsiteConfiguration(bucketName,new BucketWebsiteConfiguration(indexHTML, errorHTML));

Here, bucketName the name of our bucket, in which the website source code will be added. The indexHTML and errorHTML parameters are the landing and error pages, respectively, which are specified to the bucket website configuration. In case an error occurs, the errorHTML page will be displayed.

To get the bucket website configuration, we have a method in AmazonS3, which is as follows:

BucketWebsiteConfiguration configuration = s3.getBucketWebsiteConfiguration(bucketName);

Here, bucketName will be passed, and we need to fetch its bucket...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime