# ReplaceKey

- Source: [`aws-s3/lib/bucket.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-s3/lib/bucket.ts#L3816)

## Example

```ts
const bucket = new s3.Bucket(this, 'MyRedirectedBucket', {
  websiteRoutingRules: [
    {
      hostName: 'www.example.com',
      httpRedirectCode: '302',
      protocol: s3.RedirectProtocol.HTTPS,
      replaceKey: s3.ReplaceKey.prefixWith('test/'),
      condition: {
        httpErrorCodeReturnedEquals: '200',
        keyPrefixEquals: 'prefix',
      },
    },
  ],
});
```

## Properties

- `prefixWithKey`: string

- `withKey`: string

## Methods

- `prefixWith(keyReplacement: string): ReplaceKey // chainable` (static) — The object key prefix to use in the redirect request.

- `with(keyReplacement: string): ReplaceKey // chainable` (static) — The specific object key to use in the redirect request.
