BucketWebsiteConfigurationV2Args

data class BucketWebsiteConfigurationV2Args(val bucket: Output<String>? = null, val errorDocument: Output<BucketWebsiteConfigurationV2ErrorDocumentArgs>? = null, val expectedBucketOwner: Output<String>? = null, val indexDocument: Output<BucketWebsiteConfigurationV2IndexDocumentArgs>? = null, val redirectAllRequestsTo: Output<BucketWebsiteConfigurationV2RedirectAllRequestsToArgs>? = null, val routingRuleDetails: Output<String>? = null, val routingRules: Output<List<BucketWebsiteConfigurationV2RoutingRuleArgs>>? = null) : ConvertibleToJava<BucketWebsiteConfigurationV2Args>

Provides an S3 bucket website configuration resource. For more information, see Hosting Websites on S3.

Example Usage

With routing_rule configured

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.s3.BucketWebsiteConfigurationV2;
import com.pulumi.aws.s3.BucketWebsiteConfigurationV2Args;
import com.pulumi.aws.s3.inputs.BucketWebsiteConfigurationV2IndexDocumentArgs;
import com.pulumi.aws.s3.inputs.BucketWebsiteConfigurationV2ErrorDocumentArgs;
import com.pulumi.aws.s3.inputs.BucketWebsiteConfigurationV2RoutingRuleArgs;
import com.pulumi.aws.s3.inputs.BucketWebsiteConfigurationV2RoutingRuleConditionArgs;
import com.pulumi.aws.s3.inputs.BucketWebsiteConfigurationV2RoutingRuleRedirectArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var example = new BucketWebsiteConfigurationV2("example", BucketWebsiteConfigurationV2Args.builder()
.bucket(aws_s3_bucket.example().id())
.indexDocument(BucketWebsiteConfigurationV2IndexDocumentArgs.builder()
.suffix("index.html")
.build())
.errorDocument(BucketWebsiteConfigurationV2ErrorDocumentArgs.builder()
.key("error.html")
.build())
.routingRules(BucketWebsiteConfigurationV2RoutingRuleArgs.builder()
.condition(BucketWebsiteConfigurationV2RoutingRuleConditionArgs.builder()
.keyPrefixEquals("docs/")
.build())
.redirect(BucketWebsiteConfigurationV2RoutingRuleRedirectArgs.builder()
.replaceKeyPrefixWith("documents/")
.build())
.build())
.build());
}
}

With routing_rules configured

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.s3.BucketWebsiteConfigurationV2;
import com.pulumi.aws.s3.BucketWebsiteConfigurationV2Args;
import com.pulumi.aws.s3.inputs.BucketWebsiteConfigurationV2IndexDocumentArgs;
import com.pulumi.aws.s3.inputs.BucketWebsiteConfigurationV2ErrorDocumentArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var example = new BucketWebsiteConfigurationV2("example", BucketWebsiteConfigurationV2Args.builder()
.bucket(aws_s3_bucket.example().id())
.indexDocument(BucketWebsiteConfigurationV2IndexDocumentArgs.builder()
.suffix("index.html")
.build())
.errorDocument(BucketWebsiteConfigurationV2ErrorDocumentArgs.builder()
.key("error.html")
.build())
.routingRuleDetails("""
[{
"Condition": {
"KeyPrefixEquals": "docs/"
},
"Redirect": {
"ReplaceKeyPrefixWith": ""
}
}]
""")
.build());
}
}

Import

S3 bucket website configuration can be imported in one of two ways. If the owner (account ID) of the source bucket is the same account used to configure the AWS Provider, the S3 bucket website configuration resource should be imported using the bucket e.g.,

$ pulumi import aws:s3/bucketWebsiteConfigurationV2:BucketWebsiteConfigurationV2 example bucket-name

If the owner (account ID) of the source bucket differs from the account used to configure the AWS Provider, the S3 bucket website configuration resource should be imported using the bucket and expected_bucket_owner separated by a comma (,) e.g.,

$ pulumi import aws:s3/bucketWebsiteConfigurationV2:BucketWebsiteConfigurationV2 example bucket-name,123456789012

Constructors

Link copied to clipboard
constructor(bucket: Output<String>? = null, errorDocument: Output<BucketWebsiteConfigurationV2ErrorDocumentArgs>? = null, expectedBucketOwner: Output<String>? = null, indexDocument: Output<BucketWebsiteConfigurationV2IndexDocumentArgs>? = null, redirectAllRequestsTo: Output<BucketWebsiteConfigurationV2RedirectAllRequestsToArgs>? = null, routingRuleDetails: Output<String>? = null, routingRules: Output<List<BucketWebsiteConfigurationV2RoutingRuleArgs>>? = null)

Properties

Link copied to clipboard
val bucket: Output<String>? = null

Name of the bucket.

Link copied to clipboard

Name of the error document for the website. See below.

Link copied to clipboard
val expectedBucketOwner: Output<String>? = null

Account ID of the expected bucket owner.

Link copied to clipboard

Name of the index document for the website. See below.

Link copied to clipboard

Redirect behavior for every request to this bucket's website endpoint. See below. Conflicts with error_document, index_document, and routing_rule.

Link copied to clipboard
val routingRuleDetails: Output<String>? = null

JSON array containing routing rules describing redirect behavior and when redirects are applied. Use this parameter when your routing rules contain empty String values ("") as seen in the example above.

Link copied to clipboard

List of rules that define when a redirect is applied and the redirect behavior. See below.

Functions

Link copied to clipboard
open override fun toJava(): BucketWebsiteConfigurationV2Args