BucketWebsiteConfigurationV2

class BucketWebsiteConfigurationV2 : KotlinCustomResource

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

Properties

Link copied to clipboard
val bucket: Output<String>

Name of the bucket.

Link copied to clipboard

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

Link copied to clipboard

Account ID of the expected bucket owner.

Link copied to clipboard
val id: Output<String>
Link copied to clipboard

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

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
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

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.

Link copied to clipboard
val urn: Output<String>
Link copied to clipboard
val websiteDomain: Output<String>

Domain of the website endpoint. This is used to create Route 53 alias records.

Link copied to clipboard
val websiteEndpoint: Output<String>

Website endpoint.