Skip to content
v2.278.0

WebsiteConfigurationProperty Struct ​

Specifies website configuration parameters for an Amazon S3 bucket.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_s3 as s3 } from 'aws-cdk-lib';
const websiteConfigurationProperty: s3.CfnBucket.WebsiteConfigurationProperty = {
  errorDocument: 'errorDocument',
  indexDocument: 'indexDocument',
  redirectAllRequestsTo: {
    hostName: 'hostName',

    // the properties below are optional
    protocol: 'protocol',
  },
  routingRules: [{
    redirectRule: {
      hostName: 'hostName',
      httpRedirectCode: 'httpRedirectCode',
      protocol: 'protocol',
      replaceKeyPrefixWith: 'replaceKeyPrefixWith',
      replaceKeyWith: 'replaceKeyWith',
    },

    // the properties below are optional
    routingRuleCondition: {
      httpErrorCodeReturnedEquals: 'httpErrorCodeReturnedEquals',
      keyPrefixEquals: 'keyPrefixEquals',
    },
  }],
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_s3 as s3

website_configuration_property = s3.CfnBucket.WebsiteConfigurationProperty(
    error_document="errorDocument",
    index_document="indexDocument",
    redirect_all_requests_to=s3.CfnBucket.RedirectAllRequestsToProperty(
        host_name="hostName",

        # the properties below are optional
        protocol="protocol"
    ),
    routing_rules=[s3.CfnBucket.RoutingRuleProperty(
        redirect_rule=s3.CfnBucket.RedirectRuleProperty(
            host_name="hostName",
            http_redirect_code="httpRedirectCode",
            protocol="protocol",
            replace_key_prefix_with="replaceKeyPrefixWith",
            replace_key_with="replaceKeyWith"
        ),

        # the properties below are optional
        routing_rule_condition=s3.CfnBucket.RoutingRuleConditionProperty(
            http_error_code_returned_equals="httpErrorCodeReturnedEquals",
            key_prefix_equals="keyPrefixEquals"
        )
    )]
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.s3.*;

WebsiteConfigurationProperty websiteConfigurationProperty = WebsiteConfigurationProperty.builder()
        .errorDocument("errorDocument")
        .indexDocument("indexDocument")
        .redirectAllRequestsTo(RedirectAllRequestsToProperty.builder()
                .hostName("hostName")

                // the properties below are optional
                .protocol("protocol")
                .build())
        .routingRules(List.of(RoutingRuleProperty.builder()
                .redirectRule(RedirectRuleProperty.builder()
                        .hostName("hostName")
                        .httpRedirectCode("httpRedirectCode")
                        .protocol("protocol")
                        .replaceKeyPrefixWith("replaceKeyPrefixWith")
                        .replaceKeyWith("replaceKeyWith")
                        .build())

                // the properties below are optional
                .routingRuleCondition(RoutingRuleConditionProperty.builder()
                        .httpErrorCodeReturnedEquals("httpErrorCodeReturnedEquals")
                        .keyPrefixEquals("keyPrefixEquals")
                        .build())
                .build()))
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.S3;

var websiteConfigurationProperty = new WebsiteConfigurationProperty {
    ErrorDocument = "errorDocument",
    IndexDocument = "indexDocument",
    RedirectAllRequestsTo = new RedirectAllRequestsToProperty {
        HostName = "hostName",

        // the properties below are optional
        Protocol = "protocol"
    },
    RoutingRules = new [] { new RoutingRuleProperty {
        RedirectRule = new RedirectRuleProperty {
            HostName = "hostName",
            HttpRedirectCode = "httpRedirectCode",
            Protocol = "protocol",
            ReplaceKeyPrefixWith = "replaceKeyPrefixWith",
            ReplaceKeyWith = "replaceKeyWith"
        },

        // the properties below are optional
        RoutingRuleCondition = new RoutingRuleConditionProperty {
            HttpErrorCodeReturnedEquals = "httpErrorCodeReturnedEquals",
            KeyPrefixEquals = "keyPrefixEquals"
        }
    } }
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

websiteConfigurationProperty := &WebsiteConfigurationProperty{
	ErrorDocument: jsii.String("errorDocument"),
	IndexDocument: jsii.String("indexDocument"),
	RedirectAllRequestsTo: &RedirectAllRequestsToProperty{
		HostName: jsii.String("hostName"),

		// the properties below are optional
		Protocol: jsii.String("protocol"),
	},
	RoutingRules: []interface{}{
		&RoutingRuleProperty{
			RedirectRule: &RedirectRuleProperty{
				HostName: jsii.String("hostName"),
				HttpRedirectCode: jsii.String("httpRedirectCode"),
				Protocol: jsii.String("protocol"),
				ReplaceKeyPrefixWith: jsii.String("replaceKeyPrefixWith"),
				ReplaceKeyWith: jsii.String("replaceKeyWith"),
			},

			// the properties below are optional
			RoutingRuleCondition: &RoutingRuleConditionProperty{
				HttpErrorCodeReturnedEquals: jsii.String("httpErrorCodeReturnedEquals"),
				KeyPrefixEquals: jsii.String("keyPrefixEquals"),
			},
		},
	},
}

Properties ​

errorDocumentoptionalstringerror_documentoptionalstrerrorDocumentoptionalStringErrorDocumentoptionalstringErrorDocumentoptional*string #
The name of the error document for the website.
indexDocumentoptionalstringindex_documentoptionalstrindexDocumentoptionalStringIndexDocumentoptionalstringIndexDocumentoptional*string #
The name of the index document for the website.
redirectAllRequestsTooptionalIResolvable | CfnBucket.RedirectAllRequestsToPropertyredirect_all_requests_tooptionaltyping.Union[IResolvable, RedirectAllRequestsToProperty]redirectAllRequestsTooptionalIResolvableRedirectAllRequestsTooptionalIResolvableRedirectAllRequestsTooptionalinterface{} #
The redirect behavior for every request to this bucket's website endpoint.

If you specify this property, you can't specify any other property.

routingRulesoptionalIResolvable | IResolvable | CfnBucket.RoutingRuleProperty[]routing_rulesoptionaltyping.Union[IResolvable, typing.List[typing.Union[IResolvable, RoutingRuleProperty]]]routingRulesoptionalIResolvableRoutingRulesoptionalIResolvableRoutingRulesoptionalinterface{} #
Rules that define when a redirect is applied and the redirect behavior.