//snippet-sourcedescription:[SetWebsiteConfiguration.java demonstrates how to set the website configuration for an S3 bucket.]
//snippet-keyword:[SDK for Java 2.0]
//snippet-keyword:[Code Sample]
//snippet-service:[s3]
//snippet-sourcetype:[full-example]
//snippet-sourcedate:[2020-02-06]
//snippet-sourceauthor:[soo-aws]
/*
   Copyright 2010-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
   This file is licensed under the Apache License, Version 2.0 (the "License").
   You may not use this file except in compliancewith the License. A copy of
   the License is located at
    http://aws.amazon.com/apache2.0/
   This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
   CONDITIONS OF ANY KIND, either express or implied. See the License for the
   specific language governing permissions and limitations under the License.
*/
package com.example.s3;
// snippet-start:[s3.java2.set_website_configuration.complete]
// snippet-start:[s3.java2.set_website_configuration.import]

import software.amazon.awssdk.services.s3.S3Client;
import software.amazon.awssdk.services.s3.model.ErrorDocument;
import software.amazon.awssdk.services.s3.model.IndexDocument;
import software.amazon.awssdk.services.s3.model.PutBucketWebsiteRequest;
import software.amazon.awssdk.services.s3.model.WebsiteConfiguration;
import software.amazon.awssdk.services.s3.model.S3Exception;
import software.amazon.awssdk.regions.Region;

// snippet-end:[s3.java2.set_website_configuration.import]
/**
 * Set the website configuration for an S3 bucket.
 *
 * This code expects that you have AWS credentials set up, as described here:
 * http://docs.aws.amazon.com/java-sdk/latest/developer-guide/setup-credentials.html
 */
// snippet-start:[s3.java2.set_website_configuration.main]
public class SetWebsiteConfiguration {

    public static void main(String[] args) {

        final String USAGE = "\n" +
                "SetWebsiteConfiguration - set the website configuration for an S3 bucket\n\n" +
                "Usage: SetWebsiteConfiguration <bucket> [indexdoc] [errordoc]\n\n" +
                "Where:\n" +
                "   bucket   - the bucket to set the website configuration on\n" +
                "   indexdoc - (optional) the index document, ex. 'index.html'\n" +
                "              If not specified, 'index.html' will be set.\n" +
                "   errordoc - (optional) the error document, ex. 'notfound.html'\n" +
                "              If not specified, no error doc will be set.\n";

        if (args.length < 1) {
            System.out.println(USAGE);
            System.exit(1);
        }

        final String bucketName = args[0];
        final String indexDoc = (args.length > 1) ? args[1] : "index.html";
        final String errorDoc = (args.length > 2) ? args[2] : null;

        setWebsiteConfig(bucketName, indexDoc, errorDoc);
    }


    public static void setWebsiteConfig(
            String bucketName, String indexDoc, String errorDoc) {

        WebsiteConfiguration websiteConfig = WebsiteConfiguration.builder()
                .indexDocument(IndexDocument.builder().suffix(indexDoc).build())
                .errorDocument(ErrorDocument.builder().key(errorDoc).build())
                .build();

        Region region = Region.US_WEST_2;
        S3Client s3 = S3Client.builder().region(region).build();

        PutBucketWebsiteRequest pubWebsiteReq = PutBucketWebsiteRequest.builder()
                .bucket(bucketName)
                .websiteConfiguration(websiteConfig)
                .build();

        try {
            s3.putBucketWebsite(pubWebsiteReq);
        } catch (S3Exception e) {
            System.out.format(
                    "Failed to set website configuration for bucket '%s'!\n",
                    bucketName);
            System.err.println(e.awsErrorDetails().errorMessage());
            System.exit(1);
        }
    }
 }
// snippet-end:[s3.java2.set_website_configuration.main]
// snippet-end:[s3.java2.set_website_configuration.complete]

@@ -100,32 +100,39 @@
 guration for an 
+Amazon 
 S3 bucket.%5D%0D%0A//s
@@ -218,17 +218,24 @@
 ervice:%5B
-s
+Amazon S
 3%5D%0D%0A//sn
@@ -294,17 +294,15 @@
 e:%5B2
-020-02-06
+/6/2020
 %5D%0D%0A/
@@ -329,10 +329,15 @@
 r:%5Bs
-oo
+cmacdon
 -aws
@@ -360,18 +360,8 @@
 ght 
-2010-2020 
 Amaz
@@ -904,70 +904,8 @@
 3;%0D%0A
-// snippet-start:%5Bs3.java2.set_website_configuration.complete%5D
 %0D%0A//
@@ -964,18 +964,16 @@
 mport%5D%0D%0A
-%0D%0A
 import s
@@ -1399,18 +1399,16 @@
 egion;%0D%0A
-%0D%0A
 // snipp
@@ -1459,16 +1459,18 @@
 mport%5D%0D%0A
+%0D%0A
 /**%0D%0A * 
@@ -1696,66 +1696,8 @@
 */%0D%0A
-// snippet-start:%5Bs3.java2.set_website_configuration.main%5D
 %0D%0Apu
@@ -2830,16 +2830,78 @@
    %7D%0D%0A%0D%0A
+    // snippet-start:%5Bs3.java2.set_website_configuration.main%5D
 %0D%0A    pu
@@ -4013,66 +4013,4 @@
 n%5D%0D%0A
-// snippet-end:%5Bs3.java2.set_website_configuration.complete%5D%0D%0A

Update SetWebsiteConfiguration.java