1. Packages
  2. AWS Classic
  3. API Docs
  4. s3
  5. BucketWebsiteConfigurationV2

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.32.0 published on Friday, Apr 19, 2024 by Pulumi

aws.s3.BucketWebsiteConfigurationV2

Explore with Pulumi AI

aws logo

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.32.0 published on Friday, Apr 19, 2024 by Pulumi

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

    This resource cannot be used with S3 directory buckets.

    Example Usage

    With routing_rule configured

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const example = new aws.s3.BucketWebsiteConfigurationV2("example", {
        bucket: exampleAwsS3Bucket.id,
        indexDocument: {
            suffix: "index.html",
        },
        errorDocument: {
            key: "error.html",
        },
        routingRules: [{
            condition: {
                keyPrefixEquals: "docs/",
            },
            redirect: {
                replaceKeyPrefixWith: "documents/",
            },
        }],
    });
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.s3.BucketWebsiteConfigurationV2("example",
        bucket=example_aws_s3_bucket["id"],
        index_document=aws.s3.BucketWebsiteConfigurationV2IndexDocumentArgs(
            suffix="index.html",
        ),
        error_document=aws.s3.BucketWebsiteConfigurationV2ErrorDocumentArgs(
            key="error.html",
        ),
        routing_rules=[aws.s3.BucketWebsiteConfigurationV2RoutingRuleArgs(
            condition=aws.s3.BucketWebsiteConfigurationV2RoutingRuleConditionArgs(
                key_prefix_equals="docs/",
            ),
            redirect=aws.s3.BucketWebsiteConfigurationV2RoutingRuleRedirectArgs(
                replace_key_prefix_with="documents/",
            ),
        )])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/s3"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := s3.NewBucketWebsiteConfigurationV2(ctx, "example", &s3.BucketWebsiteConfigurationV2Args{
    			Bucket: pulumi.Any(exampleAwsS3Bucket.Id),
    			IndexDocument: &s3.BucketWebsiteConfigurationV2IndexDocumentArgs{
    				Suffix: pulumi.String("index.html"),
    			},
    			ErrorDocument: &s3.BucketWebsiteConfigurationV2ErrorDocumentArgs{
    				Key: pulumi.String("error.html"),
    			},
    			RoutingRules: s3.BucketWebsiteConfigurationV2RoutingRuleArray{
    				&s3.BucketWebsiteConfigurationV2RoutingRuleArgs{
    					Condition: &s3.BucketWebsiteConfigurationV2RoutingRuleConditionArgs{
    						KeyPrefixEquals: pulumi.String("docs/"),
    					},
    					Redirect: &s3.BucketWebsiteConfigurationV2RoutingRuleRedirectArgs{
    						ReplaceKeyPrefixWith: pulumi.String("documents/"),
    					},
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Aws.S3.BucketWebsiteConfigurationV2("example", new()
        {
            Bucket = exampleAwsS3Bucket.Id,
            IndexDocument = new Aws.S3.Inputs.BucketWebsiteConfigurationV2IndexDocumentArgs
            {
                Suffix = "index.html",
            },
            ErrorDocument = new Aws.S3.Inputs.BucketWebsiteConfigurationV2ErrorDocumentArgs
            {
                Key = "error.html",
            },
            RoutingRules = new[]
            {
                new Aws.S3.Inputs.BucketWebsiteConfigurationV2RoutingRuleArgs
                {
                    Condition = new Aws.S3.Inputs.BucketWebsiteConfigurationV2RoutingRuleConditionArgs
                    {
                        KeyPrefixEquals = "docs/",
                    },
                    Redirect = new Aws.S3.Inputs.BucketWebsiteConfigurationV2RoutingRuleRedirectArgs
                    {
                        ReplaceKeyPrefixWith = "documents/",
                    },
                },
            },
        });
    
    });
    
    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(exampleAwsS3Bucket.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());
    
        }
    }
    
    resources:
      example:
        type: aws:s3:BucketWebsiteConfigurationV2
        properties:
          bucket: ${exampleAwsS3Bucket.id}
          indexDocument:
            suffix: index.html
          errorDocument:
            key: error.html
          routingRules:
            - condition:
                keyPrefixEquals: docs/
              redirect:
                replaceKeyPrefixWith: documents/
    

    With routing_rules configured

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const example = new aws.s3.BucketWebsiteConfigurationV2("example", {
        bucket: exampleAwsS3Bucket.id,
        indexDocument: {
            suffix: "index.html",
        },
        errorDocument: {
            key: "error.html",
        },
        routingRuleDetails: `[{
        "Condition": {
            "KeyPrefixEquals": "docs/"
        },
        "Redirect": {
            "ReplaceKeyPrefixWith": ""
        }
    }]
    `,
    });
    
    import pulumi
    import pulumi_aws as aws
    
    example = aws.s3.BucketWebsiteConfigurationV2("example",
        bucket=example_aws_s3_bucket["id"],
        index_document=aws.s3.BucketWebsiteConfigurationV2IndexDocumentArgs(
            suffix="index.html",
        ),
        error_document=aws.s3.BucketWebsiteConfigurationV2ErrorDocumentArgs(
            key="error.html",
        ),
        routing_rule_details="""[{
        "Condition": {
            "KeyPrefixEquals": "docs/"
        },
        "Redirect": {
            "ReplaceKeyPrefixWith": ""
        }
    }]
    """)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/s3"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := s3.NewBucketWebsiteConfigurationV2(ctx, "example", &s3.BucketWebsiteConfigurationV2Args{
    			Bucket: pulumi.Any(exampleAwsS3Bucket.Id),
    			IndexDocument: &s3.BucketWebsiteConfigurationV2IndexDocumentArgs{
    				Suffix: pulumi.String("index.html"),
    			},
    			ErrorDocument: &s3.BucketWebsiteConfigurationV2ErrorDocumentArgs{
    				Key: pulumi.String("error.html"),
    			},
    			RoutingRuleDetails: pulumi.String(`[{
        "Condition": {
            "KeyPrefixEquals": "docs/"
        },
        "Redirect": {
            "ReplaceKeyPrefixWith": ""
        }
    }]
    `),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Aws.S3.BucketWebsiteConfigurationV2("example", new()
        {
            Bucket = exampleAwsS3Bucket.Id,
            IndexDocument = new Aws.S3.Inputs.BucketWebsiteConfigurationV2IndexDocumentArgs
            {
                Suffix = "index.html",
            },
            ErrorDocument = new Aws.S3.Inputs.BucketWebsiteConfigurationV2ErrorDocumentArgs
            {
                Key = "error.html",
            },
            RoutingRuleDetails = @"[{
        ""Condition"": {
            ""KeyPrefixEquals"": ""docs/""
        },
        ""Redirect"": {
            ""ReplaceKeyPrefixWith"": """"
        }
    }]
    ",
        });
    
    });
    
    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(exampleAwsS3Bucket.id())
                .indexDocument(BucketWebsiteConfigurationV2IndexDocumentArgs.builder()
                    .suffix("index.html")
                    .build())
                .errorDocument(BucketWebsiteConfigurationV2ErrorDocumentArgs.builder()
                    .key("error.html")
                    .build())
                .routingRuleDetails("""
    [{
        "Condition": {
            "KeyPrefixEquals": "docs/"
        },
        "Redirect": {
            "ReplaceKeyPrefixWith": ""
        }
    }]
                """)
                .build());
    
        }
    }
    
    resources:
      example:
        type: aws:s3:BucketWebsiteConfigurationV2
        properties:
          bucket: ${exampleAwsS3Bucket.id}
          indexDocument:
            suffix: index.html
          errorDocument:
            key: error.html
          routingRuleDetails: |
            [{
                "Condition": {
                    "KeyPrefixEquals": "docs/"
                },
                "Redirect": {
                    "ReplaceKeyPrefixWith": ""
                }
            }]        
    

    Create BucketWebsiteConfigurationV2 Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new BucketWebsiteConfigurationV2(name: string, args: BucketWebsiteConfigurationV2Args, opts?: CustomResourceOptions);
    @overload
    def BucketWebsiteConfigurationV2(resource_name: str,
                                     args: BucketWebsiteConfigurationV2Args,
                                     opts: Optional[ResourceOptions] = None)
    
    @overload
    def BucketWebsiteConfigurationV2(resource_name: str,
                                     opts: Optional[ResourceOptions] = None,
                                     bucket: Optional[str] = None,
                                     error_document: Optional[BucketWebsiteConfigurationV2ErrorDocumentArgs] = None,
                                     expected_bucket_owner: Optional[str] = None,
                                     index_document: Optional[BucketWebsiteConfigurationV2IndexDocumentArgs] = None,
                                     redirect_all_requests_to: Optional[BucketWebsiteConfigurationV2RedirectAllRequestsToArgs] = None,
                                     routing_rule_details: Optional[str] = None,
                                     routing_rules: Optional[Sequence[BucketWebsiteConfigurationV2RoutingRuleArgs]] = None)
    func NewBucketWebsiteConfigurationV2(ctx *Context, name string, args BucketWebsiteConfigurationV2Args, opts ...ResourceOption) (*BucketWebsiteConfigurationV2, error)
    public BucketWebsiteConfigurationV2(string name, BucketWebsiteConfigurationV2Args args, CustomResourceOptions? opts = null)
    public BucketWebsiteConfigurationV2(String name, BucketWebsiteConfigurationV2Args args)
    public BucketWebsiteConfigurationV2(String name, BucketWebsiteConfigurationV2Args args, CustomResourceOptions options)
    
    type: aws:s3:BucketWebsiteConfigurationV2
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args BucketWebsiteConfigurationV2Args
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args BucketWebsiteConfigurationV2Args
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args BucketWebsiteConfigurationV2Args
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args BucketWebsiteConfigurationV2Args
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args BucketWebsiteConfigurationV2Args
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

    The following reference example uses placeholder values for all input properties.

    var bucketWebsiteConfigurationV2Resource = new Aws.S3.BucketWebsiteConfigurationV2("bucketWebsiteConfigurationV2Resource", new()
    {
        Bucket = "string",
        ErrorDocument = new Aws.S3.Inputs.BucketWebsiteConfigurationV2ErrorDocumentArgs
        {
            Key = "string",
        },
        ExpectedBucketOwner = "string",
        IndexDocument = new Aws.S3.Inputs.BucketWebsiteConfigurationV2IndexDocumentArgs
        {
            Suffix = "string",
        },
        RedirectAllRequestsTo = new Aws.S3.Inputs.BucketWebsiteConfigurationV2RedirectAllRequestsToArgs
        {
            HostName = "string",
            Protocol = "string",
        },
        RoutingRuleDetails = "string",
        RoutingRules = new[]
        {
            new Aws.S3.Inputs.BucketWebsiteConfigurationV2RoutingRuleArgs
            {
                Redirect = new Aws.S3.Inputs.BucketWebsiteConfigurationV2RoutingRuleRedirectArgs
                {
                    HostName = "string",
                    HttpRedirectCode = "string",
                    Protocol = "string",
                    ReplaceKeyPrefixWith = "string",
                    ReplaceKeyWith = "string",
                },
                Condition = new Aws.S3.Inputs.BucketWebsiteConfigurationV2RoutingRuleConditionArgs
                {
                    HttpErrorCodeReturnedEquals = "string",
                    KeyPrefixEquals = "string",
                },
            },
        },
    });
    
    example, err := s3.NewBucketWebsiteConfigurationV2(ctx, "bucketWebsiteConfigurationV2Resource", &s3.BucketWebsiteConfigurationV2Args{
    	Bucket: pulumi.String("string"),
    	ErrorDocument: &s3.BucketWebsiteConfigurationV2ErrorDocumentArgs{
    		Key: pulumi.String("string"),
    	},
    	ExpectedBucketOwner: pulumi.String("string"),
    	IndexDocument: &s3.BucketWebsiteConfigurationV2IndexDocumentArgs{
    		Suffix: pulumi.String("string"),
    	},
    	RedirectAllRequestsTo: &s3.BucketWebsiteConfigurationV2RedirectAllRequestsToArgs{
    		HostName: pulumi.String("string"),
    		Protocol: pulumi.String("string"),
    	},
    	RoutingRuleDetails: pulumi.String("string"),
    	RoutingRules: s3.BucketWebsiteConfigurationV2RoutingRuleArray{
    		&s3.BucketWebsiteConfigurationV2RoutingRuleArgs{
    			Redirect: &s3.BucketWebsiteConfigurationV2RoutingRuleRedirectArgs{
    				HostName:             pulumi.String("string"),
    				HttpRedirectCode:     pulumi.String("string"),
    				Protocol:             pulumi.String("string"),
    				ReplaceKeyPrefixWith: pulumi.String("string"),
    				ReplaceKeyWith:       pulumi.String("string"),
    			},
    			Condition: &s3.BucketWebsiteConfigurationV2RoutingRuleConditionArgs{
    				HttpErrorCodeReturnedEquals: pulumi.String("string"),
    				KeyPrefixEquals:             pulumi.String("string"),
    			},
    		},
    	},
    })
    
    var bucketWebsiteConfigurationV2Resource = new BucketWebsiteConfigurationV2("bucketWebsiteConfigurationV2Resource", BucketWebsiteConfigurationV2Args.builder()        
        .bucket("string")
        .errorDocument(BucketWebsiteConfigurationV2ErrorDocumentArgs.builder()
            .key("string")
            .build())
        .expectedBucketOwner("string")
        .indexDocument(BucketWebsiteConfigurationV2IndexDocumentArgs.builder()
            .suffix("string")
            .build())
        .redirectAllRequestsTo(BucketWebsiteConfigurationV2RedirectAllRequestsToArgs.builder()
            .hostName("string")
            .protocol("string")
            .build())
        .routingRuleDetails("string")
        .routingRules(BucketWebsiteConfigurationV2RoutingRuleArgs.builder()
            .redirect(BucketWebsiteConfigurationV2RoutingRuleRedirectArgs.builder()
                .hostName("string")
                .httpRedirectCode("string")
                .protocol("string")
                .replaceKeyPrefixWith("string")
                .replaceKeyWith("string")
                .build())
            .condition(BucketWebsiteConfigurationV2RoutingRuleConditionArgs.builder()
                .httpErrorCodeReturnedEquals("string")
                .keyPrefixEquals("string")
                .build())
            .build())
        .build());
    
    bucket_website_configuration_v2_resource = aws.s3.BucketWebsiteConfigurationV2("bucketWebsiteConfigurationV2Resource",
        bucket="string",
        error_document=aws.s3.BucketWebsiteConfigurationV2ErrorDocumentArgs(
            key="string",
        ),
        expected_bucket_owner="string",
        index_document=aws.s3.BucketWebsiteConfigurationV2IndexDocumentArgs(
            suffix="string",
        ),
        redirect_all_requests_to=aws.s3.BucketWebsiteConfigurationV2RedirectAllRequestsToArgs(
            host_name="string",
            protocol="string",
        ),
        routing_rule_details="string",
        routing_rules=[aws.s3.BucketWebsiteConfigurationV2RoutingRuleArgs(
            redirect=aws.s3.BucketWebsiteConfigurationV2RoutingRuleRedirectArgs(
                host_name="string",
                http_redirect_code="string",
                protocol="string",
                replace_key_prefix_with="string",
                replace_key_with="string",
            ),
            condition=aws.s3.BucketWebsiteConfigurationV2RoutingRuleConditionArgs(
                http_error_code_returned_equals="string",
                key_prefix_equals="string",
            ),
        )])
    
    const bucketWebsiteConfigurationV2Resource = new aws.s3.BucketWebsiteConfigurationV2("bucketWebsiteConfigurationV2Resource", {
        bucket: "string",
        errorDocument: {
            key: "string",
        },
        expectedBucketOwner: "string",
        indexDocument: {
            suffix: "string",
        },
        redirectAllRequestsTo: {
            hostName: "string",
            protocol: "string",
        },
        routingRuleDetails: "string",
        routingRules: [{
            redirect: {
                hostName: "string",
                httpRedirectCode: "string",
                protocol: "string",
                replaceKeyPrefixWith: "string",
                replaceKeyWith: "string",
            },
            condition: {
                httpErrorCodeReturnedEquals: "string",
                keyPrefixEquals: "string",
            },
        }],
    });
    
    type: aws:s3:BucketWebsiteConfigurationV2
    properties:
        bucket: string
        errorDocument:
            key: string
        expectedBucketOwner: string
        indexDocument:
            suffix: string
        redirectAllRequestsTo:
            hostName: string
            protocol: string
        routingRuleDetails: string
        routingRules:
            - condition:
                httpErrorCodeReturnedEquals: string
                keyPrefixEquals: string
              redirect:
                hostName: string
                httpRedirectCode: string
                protocol: string
                replaceKeyPrefixWith: string
                replaceKeyWith: string
    

    BucketWebsiteConfigurationV2 Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The BucketWebsiteConfigurationV2 resource accepts the following input properties:

    Bucket string
    Name of the bucket.
    ErrorDocument BucketWebsiteConfigurationV2ErrorDocument
    Name of the error document for the website. See below.
    ExpectedBucketOwner string
    Account ID of the expected bucket owner.
    IndexDocument BucketWebsiteConfigurationV2IndexDocument
    Name of the index document for the website. See below.
    RedirectAllRequestsTo BucketWebsiteConfigurationV2RedirectAllRequestsTo
    Redirect behavior for every request to this bucket's website endpoint. See below. Conflicts with error_document, index_document, and routing_rule.
    RoutingRuleDetails string
    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.
    RoutingRules List<BucketWebsiteConfigurationV2RoutingRule>
    List of rules that define when a redirect is applied and the redirect behavior. See below.
    Bucket string
    Name of the bucket.
    ErrorDocument BucketWebsiteConfigurationV2ErrorDocumentArgs
    Name of the error document for the website. See below.
    ExpectedBucketOwner string
    Account ID of the expected bucket owner.
    IndexDocument BucketWebsiteConfigurationV2IndexDocumentArgs
    Name of the index document for the website. See below.
    RedirectAllRequestsTo BucketWebsiteConfigurationV2RedirectAllRequestsToArgs
    Redirect behavior for every request to this bucket's website endpoint. See below. Conflicts with error_document, index_document, and routing_rule.
    RoutingRuleDetails string
    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.
    RoutingRules []BucketWebsiteConfigurationV2RoutingRuleArgs
    List of rules that define when a redirect is applied and the redirect behavior. See below.
    bucket String
    Name of the bucket.
    errorDocument BucketWebsiteConfigurationV2ErrorDocument
    Name of the error document for the website. See below.
    expectedBucketOwner String
    Account ID of the expected bucket owner.
    indexDocument BucketWebsiteConfigurationV2IndexDocument
    Name of the index document for the website. See below.
    redirectAllRequestsTo BucketWebsiteConfigurationV2RedirectAllRequestsTo
    Redirect behavior for every request to this bucket's website endpoint. See below. Conflicts with error_document, index_document, and routing_rule.
    routingRuleDetails String
    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.
    routingRules List<BucketWebsiteConfigurationV2RoutingRule>
    List of rules that define when a redirect is applied and the redirect behavior. See below.
    bucket string
    Name of the bucket.
    errorDocument BucketWebsiteConfigurationV2ErrorDocument
    Name of the error document for the website. See below.
    expectedBucketOwner string
    Account ID of the expected bucket owner.
    indexDocument BucketWebsiteConfigurationV2IndexDocument
    Name of the index document for the website. See below.
    redirectAllRequestsTo BucketWebsiteConfigurationV2RedirectAllRequestsTo
    Redirect behavior for every request to this bucket's website endpoint. See below. Conflicts with error_document, index_document, and routing_rule.
    routingRuleDetails string
    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.
    routingRules BucketWebsiteConfigurationV2RoutingRule[]
    List of rules that define when a redirect is applied and the redirect behavior. See below.
    bucket str
    Name of the bucket.
    error_document BucketWebsiteConfigurationV2ErrorDocumentArgs
    Name of the error document for the website. See below.
    expected_bucket_owner str
    Account ID of the expected bucket owner.
    index_document BucketWebsiteConfigurationV2IndexDocumentArgs
    Name of the index document for the website. See below.
    redirect_all_requests_to BucketWebsiteConfigurationV2RedirectAllRequestsToArgs
    Redirect behavior for every request to this bucket's website endpoint. See below. Conflicts with error_document, index_document, and routing_rule.
    routing_rule_details str
    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.
    routing_rules Sequence[BucketWebsiteConfigurationV2RoutingRuleArgs]
    List of rules that define when a redirect is applied and the redirect behavior. See below.
    bucket String
    Name of the bucket.
    errorDocument Property Map
    Name of the error document for the website. See below.
    expectedBucketOwner String
    Account ID of the expected bucket owner.
    indexDocument Property Map
    Name of the index document for the website. See below.
    redirectAllRequestsTo Property Map
    Redirect behavior for every request to this bucket's website endpoint. See below. Conflicts with error_document, index_document, and routing_rule.
    routingRuleDetails String
    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.
    routingRules List<Property Map>
    List of rules that define when a redirect is applied and the redirect behavior. See below.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the BucketWebsiteConfigurationV2 resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    WebsiteDomain string
    Domain of the website endpoint. This is used to create Route 53 alias records.
    WebsiteEndpoint string
    Website endpoint.
    Id string
    The provider-assigned unique ID for this managed resource.
    WebsiteDomain string
    Domain of the website endpoint. This is used to create Route 53 alias records.
    WebsiteEndpoint string
    Website endpoint.
    id String
    The provider-assigned unique ID for this managed resource.
    websiteDomain String
    Domain of the website endpoint. This is used to create Route 53 alias records.
    websiteEndpoint String
    Website endpoint.
    id string
    The provider-assigned unique ID for this managed resource.
    websiteDomain string
    Domain of the website endpoint. This is used to create Route 53 alias records.
    websiteEndpoint string
    Website endpoint.
    id str
    The provider-assigned unique ID for this managed resource.
    website_domain str
    Domain of the website endpoint. This is used to create Route 53 alias records.
    website_endpoint str
    Website endpoint.
    id String
    The provider-assigned unique ID for this managed resource.
    websiteDomain String
    Domain of the website endpoint. This is used to create Route 53 alias records.
    websiteEndpoint String
    Website endpoint.

    Look up Existing BucketWebsiteConfigurationV2 Resource

    Get an existing BucketWebsiteConfigurationV2 resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: BucketWebsiteConfigurationV2State, opts?: CustomResourceOptions): BucketWebsiteConfigurationV2
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            bucket: Optional[str] = None,
            error_document: Optional[BucketWebsiteConfigurationV2ErrorDocumentArgs] = None,
            expected_bucket_owner: Optional[str] = None,
            index_document: Optional[BucketWebsiteConfigurationV2IndexDocumentArgs] = None,
            redirect_all_requests_to: Optional[BucketWebsiteConfigurationV2RedirectAllRequestsToArgs] = None,
            routing_rule_details: Optional[str] = None,
            routing_rules: Optional[Sequence[BucketWebsiteConfigurationV2RoutingRuleArgs]] = None,
            website_domain: Optional[str] = None,
            website_endpoint: Optional[str] = None) -> BucketWebsiteConfigurationV2
    func GetBucketWebsiteConfigurationV2(ctx *Context, name string, id IDInput, state *BucketWebsiteConfigurationV2State, opts ...ResourceOption) (*BucketWebsiteConfigurationV2, error)
    public static BucketWebsiteConfigurationV2 Get(string name, Input<string> id, BucketWebsiteConfigurationV2State? state, CustomResourceOptions? opts = null)
    public static BucketWebsiteConfigurationV2 get(String name, Output<String> id, BucketWebsiteConfigurationV2State state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    Bucket string
    Name of the bucket.
    ErrorDocument BucketWebsiteConfigurationV2ErrorDocument
    Name of the error document for the website. See below.
    ExpectedBucketOwner string
    Account ID of the expected bucket owner.
    IndexDocument BucketWebsiteConfigurationV2IndexDocument
    Name of the index document for the website. See below.
    RedirectAllRequestsTo BucketWebsiteConfigurationV2RedirectAllRequestsTo
    Redirect behavior for every request to this bucket's website endpoint. See below. Conflicts with error_document, index_document, and routing_rule.
    RoutingRuleDetails string
    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.
    RoutingRules List<BucketWebsiteConfigurationV2RoutingRule>
    List of rules that define when a redirect is applied and the redirect behavior. See below.
    WebsiteDomain string
    Domain of the website endpoint. This is used to create Route 53 alias records.
    WebsiteEndpoint string
    Website endpoint.
    Bucket string
    Name of the bucket.
    ErrorDocument BucketWebsiteConfigurationV2ErrorDocumentArgs
    Name of the error document for the website. See below.
    ExpectedBucketOwner string
    Account ID of the expected bucket owner.
    IndexDocument BucketWebsiteConfigurationV2IndexDocumentArgs
    Name of the index document for the website. See below.
    RedirectAllRequestsTo BucketWebsiteConfigurationV2RedirectAllRequestsToArgs
    Redirect behavior for every request to this bucket's website endpoint. See below. Conflicts with error_document, index_document, and routing_rule.
    RoutingRuleDetails string
    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.
    RoutingRules []BucketWebsiteConfigurationV2RoutingRuleArgs
    List of rules that define when a redirect is applied and the redirect behavior. See below.
    WebsiteDomain string
    Domain of the website endpoint. This is used to create Route 53 alias records.
    WebsiteEndpoint string
    Website endpoint.
    bucket String
    Name of the bucket.
    errorDocument BucketWebsiteConfigurationV2ErrorDocument
    Name of the error document for the website. See below.
    expectedBucketOwner String
    Account ID of the expected bucket owner.
    indexDocument BucketWebsiteConfigurationV2IndexDocument
    Name of the index document for the website. See below.
    redirectAllRequestsTo BucketWebsiteConfigurationV2RedirectAllRequestsTo
    Redirect behavior for every request to this bucket's website endpoint. See below. Conflicts with error_document, index_document, and routing_rule.
    routingRuleDetails String
    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.
    routingRules List<BucketWebsiteConfigurationV2RoutingRule>
    List of rules that define when a redirect is applied and the redirect behavior. See below.
    websiteDomain String
    Domain of the website endpoint. This is used to create Route 53 alias records.
    websiteEndpoint String
    Website endpoint.
    bucket string
    Name of the bucket.
    errorDocument BucketWebsiteConfigurationV2ErrorDocument
    Name of the error document for the website. See below.
    expectedBucketOwner string
    Account ID of the expected bucket owner.
    indexDocument BucketWebsiteConfigurationV2IndexDocument
    Name of the index document for the website. See below.
    redirectAllRequestsTo BucketWebsiteConfigurationV2RedirectAllRequestsTo
    Redirect behavior for every request to this bucket's website endpoint. See below. Conflicts with error_document, index_document, and routing_rule.
    routingRuleDetails string
    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.
    routingRules BucketWebsiteConfigurationV2RoutingRule[]
    List of rules that define when a redirect is applied and the redirect behavior. See below.
    websiteDomain string
    Domain of the website endpoint. This is used to create Route 53 alias records.
    websiteEndpoint string
    Website endpoint.
    bucket str
    Name of the bucket.
    error_document BucketWebsiteConfigurationV2ErrorDocumentArgs
    Name of the error document for the website. See below.
    expected_bucket_owner str
    Account ID of the expected bucket owner.
    index_document BucketWebsiteConfigurationV2IndexDocumentArgs
    Name of the index document for the website. See below.
    redirect_all_requests_to BucketWebsiteConfigurationV2RedirectAllRequestsToArgs
    Redirect behavior for every request to this bucket's website endpoint. See below. Conflicts with error_document, index_document, and routing_rule.
    routing_rule_details str
    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.
    routing_rules Sequence[BucketWebsiteConfigurationV2RoutingRuleArgs]
    List of rules that define when a redirect is applied and the redirect behavior. See below.
    website_domain str
    Domain of the website endpoint. This is used to create Route 53 alias records.
    website_endpoint str
    Website endpoint.
    bucket String
    Name of the bucket.
    errorDocument Property Map
    Name of the error document for the website. See below.
    expectedBucketOwner String
    Account ID of the expected bucket owner.
    indexDocument Property Map
    Name of the index document for the website. See below.
    redirectAllRequestsTo Property Map
    Redirect behavior for every request to this bucket's website endpoint. See below. Conflicts with error_document, index_document, and routing_rule.
    routingRuleDetails String
    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.
    routingRules List<Property Map>
    List of rules that define when a redirect is applied and the redirect behavior. See below.
    websiteDomain String
    Domain of the website endpoint. This is used to create Route 53 alias records.
    websiteEndpoint String
    Website endpoint.

    Supporting Types

    BucketWebsiteConfigurationV2ErrorDocument, BucketWebsiteConfigurationV2ErrorDocumentArgs

    Key string
    Object key name to use when a 4XX class error occurs.
    Key string
    Object key name to use when a 4XX class error occurs.
    key String
    Object key name to use when a 4XX class error occurs.
    key string
    Object key name to use when a 4XX class error occurs.
    key str
    Object key name to use when a 4XX class error occurs.
    key String
    Object key name to use when a 4XX class error occurs.

    BucketWebsiteConfigurationV2IndexDocument, BucketWebsiteConfigurationV2IndexDocumentArgs

    Suffix string
    Suffix that is appended to a request that is for a directory on the website endpoint. For example, if the suffix is index.html and you make a request to samplebucket/images/, the data that is returned will be for the object with the key name images/index.html. The suffix must not be empty and must not include a slash character.
    Suffix string
    Suffix that is appended to a request that is for a directory on the website endpoint. For example, if the suffix is index.html and you make a request to samplebucket/images/, the data that is returned will be for the object with the key name images/index.html. The suffix must not be empty and must not include a slash character.
    suffix String
    Suffix that is appended to a request that is for a directory on the website endpoint. For example, if the suffix is index.html and you make a request to samplebucket/images/, the data that is returned will be for the object with the key name images/index.html. The suffix must not be empty and must not include a slash character.
    suffix string
    Suffix that is appended to a request that is for a directory on the website endpoint. For example, if the suffix is index.html and you make a request to samplebucket/images/, the data that is returned will be for the object with the key name images/index.html. The suffix must not be empty and must not include a slash character.
    suffix str
    Suffix that is appended to a request that is for a directory on the website endpoint. For example, if the suffix is index.html and you make a request to samplebucket/images/, the data that is returned will be for the object with the key name images/index.html. The suffix must not be empty and must not include a slash character.
    suffix String
    Suffix that is appended to a request that is for a directory on the website endpoint. For example, if the suffix is index.html and you make a request to samplebucket/images/, the data that is returned will be for the object with the key name images/index.html. The suffix must not be empty and must not include a slash character.

    BucketWebsiteConfigurationV2RedirectAllRequestsTo, BucketWebsiteConfigurationV2RedirectAllRequestsToArgs

    HostName string
    Name of the host where requests are redirected.
    Protocol string
    Protocol to use when redirecting requests. The default is the protocol that is used in the original request. Valid values: http, https.
    HostName string
    Name of the host where requests are redirected.
    Protocol string
    Protocol to use when redirecting requests. The default is the protocol that is used in the original request. Valid values: http, https.
    hostName String
    Name of the host where requests are redirected.
    protocol String
    Protocol to use when redirecting requests. The default is the protocol that is used in the original request. Valid values: http, https.
    hostName string
    Name of the host where requests are redirected.
    protocol string
    Protocol to use when redirecting requests. The default is the protocol that is used in the original request. Valid values: http, https.
    host_name str
    Name of the host where requests are redirected.
    protocol str
    Protocol to use when redirecting requests. The default is the protocol that is used in the original request. Valid values: http, https.
    hostName String
    Name of the host where requests are redirected.
    protocol String
    Protocol to use when redirecting requests. The default is the protocol that is used in the original request. Valid values: http, https.

    BucketWebsiteConfigurationV2RoutingRule, BucketWebsiteConfigurationV2RoutingRuleArgs

    Redirect BucketWebsiteConfigurationV2RoutingRuleRedirect
    Configuration block for redirect information. See below.
    Condition BucketWebsiteConfigurationV2RoutingRuleCondition
    Configuration block for describing a condition that must be met for the specified redirect to apply. See below.
    Redirect BucketWebsiteConfigurationV2RoutingRuleRedirect
    Configuration block for redirect information. See below.
    Condition BucketWebsiteConfigurationV2RoutingRuleCondition
    Configuration block for describing a condition that must be met for the specified redirect to apply. See below.
    redirect BucketWebsiteConfigurationV2RoutingRuleRedirect
    Configuration block for redirect information. See below.
    condition BucketWebsiteConfigurationV2RoutingRuleCondition
    Configuration block for describing a condition that must be met for the specified redirect to apply. See below.
    redirect BucketWebsiteConfigurationV2RoutingRuleRedirect
    Configuration block for redirect information. See below.
    condition BucketWebsiteConfigurationV2RoutingRuleCondition
    Configuration block for describing a condition that must be met for the specified redirect to apply. See below.
    redirect BucketWebsiteConfigurationV2RoutingRuleRedirect
    Configuration block for redirect information. See below.
    condition BucketWebsiteConfigurationV2RoutingRuleCondition
    Configuration block for describing a condition that must be met for the specified redirect to apply. See below.
    redirect Property Map
    Configuration block for redirect information. See below.
    condition Property Map
    Configuration block for describing a condition that must be met for the specified redirect to apply. See below.

    BucketWebsiteConfigurationV2RoutingRuleCondition, BucketWebsiteConfigurationV2RoutingRuleConditionArgs

    HttpErrorCodeReturnedEquals string
    HTTP error code when the redirect is applied. If specified with key_prefix_equals, then both must be true for the redirect to be applied.
    KeyPrefixEquals string
    Object key name prefix when the redirect is applied. If specified with http_error_code_returned_equals, then both must be true for the redirect to be applied.
    HttpErrorCodeReturnedEquals string
    HTTP error code when the redirect is applied. If specified with key_prefix_equals, then both must be true for the redirect to be applied.
    KeyPrefixEquals string
    Object key name prefix when the redirect is applied. If specified with http_error_code_returned_equals, then both must be true for the redirect to be applied.
    httpErrorCodeReturnedEquals String
    HTTP error code when the redirect is applied. If specified with key_prefix_equals, then both must be true for the redirect to be applied.
    keyPrefixEquals String
    Object key name prefix when the redirect is applied. If specified with http_error_code_returned_equals, then both must be true for the redirect to be applied.
    httpErrorCodeReturnedEquals string
    HTTP error code when the redirect is applied. If specified with key_prefix_equals, then both must be true for the redirect to be applied.
    keyPrefixEquals string
    Object key name prefix when the redirect is applied. If specified with http_error_code_returned_equals, then both must be true for the redirect to be applied.
    http_error_code_returned_equals str
    HTTP error code when the redirect is applied. If specified with key_prefix_equals, then both must be true for the redirect to be applied.
    key_prefix_equals str
    Object key name prefix when the redirect is applied. If specified with http_error_code_returned_equals, then both must be true for the redirect to be applied.
    httpErrorCodeReturnedEquals String
    HTTP error code when the redirect is applied. If specified with key_prefix_equals, then both must be true for the redirect to be applied.
    keyPrefixEquals String
    Object key name prefix when the redirect is applied. If specified with http_error_code_returned_equals, then both must be true for the redirect to be applied.

    BucketWebsiteConfigurationV2RoutingRuleRedirect, BucketWebsiteConfigurationV2RoutingRuleRedirectArgs

    HostName string
    Host name to use in the redirect request.
    HttpRedirectCode string
    HTTP redirect code to use on the response.
    Protocol string
    Protocol to use when redirecting requests. The default is the protocol that is used in the original request. Valid values: http, https.
    ReplaceKeyPrefixWith string
    Object key prefix to use in the redirect request. For example, to redirect requests for all pages with prefix docs/ (objects in the docs/ folder) to documents/, you can set a condition block with key_prefix_equals set to docs/ and in the redirect set replace_key_prefix_with to /documents.
    ReplaceKeyWith string
    Specific object key to use in the redirect request. For example, redirect request to error.html.
    HostName string
    Host name to use in the redirect request.
    HttpRedirectCode string
    HTTP redirect code to use on the response.
    Protocol string
    Protocol to use when redirecting requests. The default is the protocol that is used in the original request. Valid values: http, https.
    ReplaceKeyPrefixWith string
    Object key prefix to use in the redirect request. For example, to redirect requests for all pages with prefix docs/ (objects in the docs/ folder) to documents/, you can set a condition block with key_prefix_equals set to docs/ and in the redirect set replace_key_prefix_with to /documents.
    ReplaceKeyWith string
    Specific object key to use in the redirect request. For example, redirect request to error.html.
    hostName String
    Host name to use in the redirect request.
    httpRedirectCode String
    HTTP redirect code to use on the response.
    protocol String
    Protocol to use when redirecting requests. The default is the protocol that is used in the original request. Valid values: http, https.
    replaceKeyPrefixWith String
    Object key prefix to use in the redirect request. For example, to redirect requests for all pages with prefix docs/ (objects in the docs/ folder) to documents/, you can set a condition block with key_prefix_equals set to docs/ and in the redirect set replace_key_prefix_with to /documents.
    replaceKeyWith String
    Specific object key to use in the redirect request. For example, redirect request to error.html.
    hostName string
    Host name to use in the redirect request.
    httpRedirectCode string
    HTTP redirect code to use on the response.
    protocol string
    Protocol to use when redirecting requests. The default is the protocol that is used in the original request. Valid values: http, https.
    replaceKeyPrefixWith string
    Object key prefix to use in the redirect request. For example, to redirect requests for all pages with prefix docs/ (objects in the docs/ folder) to documents/, you can set a condition block with key_prefix_equals set to docs/ and in the redirect set replace_key_prefix_with to /documents.
    replaceKeyWith string
    Specific object key to use in the redirect request. For example, redirect request to error.html.
    host_name str
    Host name to use in the redirect request.
    http_redirect_code str
    HTTP redirect code to use on the response.
    protocol str
    Protocol to use when redirecting requests. The default is the protocol that is used in the original request. Valid values: http, https.
    replace_key_prefix_with str
    Object key prefix to use in the redirect request. For example, to redirect requests for all pages with prefix docs/ (objects in the docs/ folder) to documents/, you can set a condition block with key_prefix_equals set to docs/ and in the redirect set replace_key_prefix_with to /documents.
    replace_key_with str
    Specific object key to use in the redirect request. For example, redirect request to error.html.
    hostName String
    Host name to use in the redirect request.
    httpRedirectCode String
    HTTP redirect code to use on the response.
    protocol String
    Protocol to use when redirecting requests. The default is the protocol that is used in the original request. Valid values: http, https.
    replaceKeyPrefixWith String
    Object key prefix to use in the redirect request. For example, to redirect requests for all pages with prefix docs/ (objects in the docs/ folder) to documents/, you can set a condition block with key_prefix_equals set to docs/ and in the redirect set replace_key_prefix_with to /documents.
    replaceKeyWith String
    Specific object key to use in the redirect request. For example, redirect request to error.html.

    Import

    If the owner (account ID) of the source bucket differs from the account used to configure the AWS Provider, import using the bucket and expected_bucket_owner separated by a comma (,):

    Using pulumi import to import S3 bucket website configuration using the bucket or using the bucket and expected_bucket_owner separated by a comma (,). For example:

    If the owner (account ID) of the source bucket is the same account used to configure the AWS Provider, import using the bucket:

    $ 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, import using the bucket and expected_bucket_owner separated by a comma (,):

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

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aws Terraform Provider.
    aws logo

    Try AWS Native preview for resources not in the classic version.

    AWS Classic v6.32.0 published on Friday, Apr 19, 2024 by Pulumi