aws-cdk-lib.aws_s3.CfnBucket.RoutingRuleProperty

interface RoutingRuleProperty

LanguageType name
.NETAmazon.CDK.AWS.S3.CfnBucket.RoutingRuleProperty
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awss3#CfnBucket_RoutingRuleProperty
Javasoftware.amazon.awscdk.services.s3.CfnBucket.RoutingRuleProperty
Pythonaws_cdk.aws_s3.CfnBucket.RoutingRuleProperty
TypeScript aws-cdk-lib » aws_s3 » CfnBucket » RoutingRuleProperty

Specifies the redirect behavior and when a redirect is applied.

For more information about routing rules, see Configuring advanced conditional redirects in the Amazon S3 User Guide .

Example

// 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 routingRuleProperty: s3.CfnBucket.RoutingRuleProperty = {
  redirectRule: {
    hostName: 'hostName',
    httpRedirectCode: 'httpRedirectCode',
    protocol: 'protocol',
    replaceKeyPrefixWith: 'replaceKeyPrefixWith',
    replaceKeyWith: 'replaceKeyWith',
  },

  // the properties below are optional
  routingRuleCondition: {
    httpErrorCodeReturnedEquals: 'httpErrorCodeReturnedEquals',
    keyPrefixEquals: 'keyPrefixEquals',
  },
};

Properties

NameTypeDescription
redirectRuleIResolvable | RedirectRulePropertyContainer for redirect information.
routingRuleCondition?IResolvable | RoutingRuleConditionPropertyA container for describing a condition that must be met for the specified redirect to apply.

redirectRule

Type: IResolvable | RedirectRuleProperty

Container for redirect information.

You can redirect requests to another host, to another page, or with another protocol. In the event of an error, you can specify a different error code to return.


routingRuleCondition?

Type: IResolvable | RoutingRuleConditionProperty (optional)

A container for describing a condition that must be met for the specified redirect to apply.

For example, 1. If request is for pages in the /docs folder, redirect to the /documents folder. 2. If request results in HTTP error 4xx, redirect request to another host where you might process the error.