docs: function configureBucket(
    aws,
    bucketName,
    indexDocument,
    errorDocument,
    redirectAllRequestsTo,
    routingRules
  ) {
    const params = {
      Bucket: bucketName,
      WebsiteConfiguration: {}
    };
  
    if (redirectAllRequestsTo) {
      params.WebsiteConfiguration.RedirectAllRequestsTo = {};
      params.WebsiteConfiguration.RedirectAllRequestsTo.HostName = redirectAllRequestsTo.hostName;
  
      if (redirectAllRequestsTo.protocol) {
        params.WebsiteConfiguration.RedirectAllRequestsTo.Protocol = redirectAllRequestsTo.protocol;
      }
    } else {
      // AWS's terminology (Suffix/Key) here is weird. The following is how you specify
      // index and error documents for the bucket. See docs:
      // https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#putBucketWebsite-property
      params.WebsiteConfiguration.IndexDocument = { Suffix: indexDocument };
      params.WebsiteConfiguration.ErrorDocument = { Key: errorDocument };
    }
  
    if (routingRules) {
      params.WebsiteConfiguration.RoutingRules = [];
  
      routingRules.forEach(r => {
        const routingRule = {
          Redirect: {}
        };
        const redirectProps = [
          'hostName',
          'httpRedirectCode',
          'protocol',
          'replaceKeyPrefixWith',
          'replaceKeyWith'
        ];
        redirectProps.forEach(p => {
          if (r.redirect[p]) {
            if (p === 'httpRedirectCode') {
              r.redirect[p] = r.redirect[p].toString();
            }
            // AWS expects the redirect properties to be PascalCase, while our API
            // uses camelCase. Converting here.
            routingRule.Redirect[p.charAt(0).toUpperCase() + p.slice(1)] = r.redirect[p];
          }
        });
  
        if (r.condition) {
          routingRule.Condition = {};
  
          const conditionProps = ['httpErrorCodeReturnedEquals', 'keyPrefixEquals'];
          conditionProps.forEach(p => {
            if (r.condition[p]) {
              if (p === 'httpErrorCodeReturnedEquals') {
                r.condition[p] = r.condition[p].toString();
              }
              // AWS expects the redirect conditions to be PascalCase, while our API
              // uses camelCase. Converting here.
              routingRule.Condition[p.charAt(0).toUpperCase() + p.slice(1)] = r.condition[p];
            }
          });
        }
  
        params.WebsiteConfiguration.RoutingRules.push(routingRule);
      });
    }
  
    return aws.request('S3', 'putBucketWebsite', params);
  }