RoutingRule

class aws_cdk.aws_s3.RoutingRule(*, condition=None, host_name=None, http_redirect_code=None, protocol=None, replace_key=None)

Bases: object

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

Parameters:
  • condition (Union[RoutingRuleCondition, Dict[str, Any], None]) – Specifies a condition that must be met for the specified redirect to apply. Default: - No condition

  • host_name (Optional[str]) – The host name to use in the redirect request. Default: - The host name used in the original request.

  • http_redirect_code (Optional[str]) – The HTTP redirect code to use on the response. Default: “301” - Moved Permanently

  • protocol (Optional[RedirectProtocol]) – Protocol to use when redirecting requests. Default: - The protocol used in the original request.

  • replace_key (Optional[ReplaceKey]) – Specifies the object key prefix to use in the redirect request. Default: - The key will not be replaced

See:

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

ExampleMetadata:

fixture=_generated

Example:

# 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

# replace_key: s3.ReplaceKey

routing_rule = s3.RoutingRule(
    condition=s3.RoutingRuleCondition(
        http_error_code_returned_equals="httpErrorCodeReturnedEquals",
        key_prefix_equals="keyPrefixEquals"
    ),
    host_name="hostName",
    http_redirect_code="httpRedirectCode",
    protocol=s3.RedirectProtocol.HTTP,
    replace_key=replace_key
)

Attributes

condition

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

Default:
  • No condition

host_name

The host name to use in the redirect request.

Default:
  • The host name used in the original request.

http_redirect_code

The HTTP redirect code to use on the response.

Default:

“301” - Moved Permanently

protocol

Protocol to use when redirecting requests.

Default:
  • The protocol used in the original request.

replace_key

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

Default:
  • The key will not be replaced