aws-cdk-lib.aws_s3.RoutingRule

interface RoutingRule

LanguageType name
.NETAmazon.CDK.AWS.S3.RoutingRule
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awss3#RoutingRule
Javasoftware.amazon.awscdk.services.s3.RoutingRule
Pythonaws_cdk.aws_s3.RoutingRule
TypeScript (source)aws-cdk-lib » aws_s3 » RoutingRule

Rule that define when a redirect is applied and the redirect behavior.

See also: https://docs.aws.amazon.com/AmazonS3/latest/dev/how-to-page-redirect.html

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';

declare const replaceKey: s3.ReplaceKey;
const routingRule: s3.RoutingRule = {
  condition: {
    httpErrorCodeReturnedEquals: 'httpErrorCodeReturnedEquals',
    keyPrefixEquals: 'keyPrefixEquals',
  },
  hostName: 'hostName',
  httpRedirectCode: 'httpRedirectCode',
  protocol: s3.RedirectProtocol.HTTP,
  replaceKey: replaceKey,
};

Properties

NameTypeDescription
condition?RoutingRuleConditionSpecifies a condition that must be met for the specified redirect to apply.
hostName?stringThe host name to use in the redirect request.
httpRedirectCode?stringThe HTTP redirect code to use on the response.
protocol?RedirectProtocolProtocol to use when redirecting requests.
replaceKey?ReplaceKeySpecifies the object key prefix to use in the redirect request.

condition?

Type: RoutingRuleCondition (optional, default: No condition)

Specifies a condition that must be met for the specified redirect to apply.


hostName?

Type: string (optional, default: The host name used in the original request.)

The host name to use in the redirect request.


httpRedirectCode?

Type: string (optional, default: "301" - Moved Permanently)

The HTTP redirect code to use on the response.


protocol?

Type: RedirectProtocol (optional, default: The protocol used in the original request.)

Protocol to use when redirecting requests.


replaceKey?

Type: ReplaceKey (optional, default: The key will not be replaced)

Specifies the object key prefix to use in the redirect request.