@cloudkitect/components
Version:
CloudKitect freemium components are scaled down versions of CloudKitect enhanced components offered as monthly or yearly subscription. These are well architected components that offer out of the box monitoring, alerting and compliance to various standards
1,331 lines (825 loc) • 496 kB
Markdown
# API Reference <a name="API Reference" id="api-reference"></a>
## Constructs <a name="Constructs" id="Constructs"></a>
### CkBucket <a name="CkBucket" id="@cloudkitect/components.CkBucket"></a>
CloudKitect S3 Bucket component.
### Default Configuration
Encryption: S3 Managed
Versioned: True
Removal Policy: Retain in Production
### Default Alarms
Available only in Enhanced components
### Logging and Monitoring
Available only in Enhanced components
Note that the default alarm uses the CcAlarm construct, which sets up an alarm
action to notify the SNS Topic *AlarmEventsTopic* by default.
### Examples
Default Usage
```ts
new CkBucket(this, "LogicalId", {
});
```
Custom Configuration
```ts
new CkBucket(this, "LogicalId", {
enforceSSL: false
});
```
### Compliance
It addresses the following compliance requirements
1. Blocks public access
> - Risk Level: Medium
> - Compliance: PCI, HIPAA, GDPR, APRA, MAS, NIST4
> - Well Architected Pillar: Security
2. Bucket versioning enabled in Production Environment
> - Risk Level: Low
> - Compliance: PCI, APRA, MAS, NIST4
> - Well Architected Pillar: Reliability
3. Block S3 Bucket Public 'READ' Access
> - Risk Level: Very High
> - Compliance: PCI, GDPR, ARPA, MAS, NIST4
> - Well Architected Pillar: Security
4. Only allow secure transport protocols
> - Risk Level: High
> - Compliance: PCI, APRA, MAS, NIST4
> - Well Architected Pillar: Security
5. Server side encryption
> - Risk Level: High
> - Compliance: PCI, HIPAA, GDPR, APRA, MAS, NIST4
> - Well Architected Pillar: Security
#### Initializers <a name="Initializers" id="@cloudkitect/components.CkBucket.Initializer"></a>
```typescript
import { CkBucket } from '@cloudkitect/components'
new CkBucket(scope: Construct, id: string, props: CkBucketProps)
```
| **Name** | **Type** | **Description** |
| --- | --- | --- |
| <code><a href="#@cloudkitect/components.CkBucket.Initializer.parameter.scope">scope</a></code> | <code>constructs.Construct</code> | *No description.* |
| <code><a href="#@cloudkitect/components.CkBucket.Initializer.parameter.id">id</a></code> | <code>string</code> | *No description.* |
| <code><a href="#@cloudkitect/components.CkBucket.Initializer.parameter.props">props</a></code> | <code><a href="#@cloudkitect/components.CkBucketProps">CkBucketProps</a></code> | *No description.* |
---
##### `scope`<sup>Required</sup> <a name="scope" id="@cloudkitect/components.CkBucket.Initializer.parameter.scope"></a>
- *Type:* constructs.Construct
---
##### `id`<sup>Required</sup> <a name="id" id="@cloudkitect/components.CkBucket.Initializer.parameter.id"></a>
- *Type:* string
---
##### `props`<sup>Required</sup> <a name="props" id="@cloudkitect/components.CkBucket.Initializer.parameter.props"></a>
- *Type:* <a href="#@cloudkitect/components.CkBucketProps">CkBucketProps</a>
---
#### Methods <a name="Methods" id="Methods"></a>
| **Name** | **Description** |
| --- | --- |
| <code><a href="#@cloudkitect/components.CkBucket.toString">toString</a></code> | Returns a string representation of this construct. |
| <code><a href="#@cloudkitect/components.CkBucket.applyRemovalPolicy">applyRemovalPolicy</a></code> | Apply the given removal policy to this resource. |
| <code><a href="#@cloudkitect/components.CkBucket.addEventNotification">addEventNotification</a></code> | Adds a bucket notification event destination. |
| <code><a href="#@cloudkitect/components.CkBucket.addObjectCreatedNotification">addObjectCreatedNotification</a></code> | Subscribes a destination to receive notifications when an object is created in the bucket. |
| <code><a href="#@cloudkitect/components.CkBucket.addObjectRemovedNotification">addObjectRemovedNotification</a></code> | Subscribes a destination to receive notifications when an object is removed from the bucket. |
| <code><a href="#@cloudkitect/components.CkBucket.addToResourcePolicy">addToResourcePolicy</a></code> | Adds a statement to the resource policy for a principal (i.e. account/role/service) to perform actions on this bucket and/or its contents. Use `bucketArn` and `arnForObjects(keys)` to obtain ARNs for this bucket or objects. |
| <code><a href="#@cloudkitect/components.CkBucket.arnForObjects">arnForObjects</a></code> | Returns an ARN that represents all objects within the bucket that match the key pattern specified. |
| <code><a href="#@cloudkitect/components.CkBucket.enableEventBridgeNotification">enableEventBridgeNotification</a></code> | Enables event bridge notification, causing all events below to be sent to EventBridge:. |
| <code><a href="#@cloudkitect/components.CkBucket.grantDelete">grantDelete</a></code> | Grants s3:DeleteObject* permission to an IAM principal for objects in this bucket. |
| <code><a href="#@cloudkitect/components.CkBucket.grantPublicAccess">grantPublicAccess</a></code> | Allows unrestricted access to objects from this bucket. |
| <code><a href="#@cloudkitect/components.CkBucket.grantPut">grantPut</a></code> | Grants s3:PutObject* and s3:Abort* permissions for this bucket to an IAM principal. |
| <code><a href="#@cloudkitect/components.CkBucket.grantPutAcl">grantPutAcl</a></code> | Grant the given IAM identity permissions to modify the ACLs of objects in the given Bucket. |
| <code><a href="#@cloudkitect/components.CkBucket.grantRead">grantRead</a></code> | Grant read permissions for this bucket and it's contents to an IAM principal (Role/Group/User). |
| <code><a href="#@cloudkitect/components.CkBucket.grantReadWrite">grantReadWrite</a></code> | Grants read/write permissions for this bucket and it's contents to an IAM principal (Role/Group/User). |
| <code><a href="#@cloudkitect/components.CkBucket.grantWrite">grantWrite</a></code> | Grant write permissions to this bucket to an IAM principal. |
| <code><a href="#@cloudkitect/components.CkBucket.onCloudTrailEvent">onCloudTrailEvent</a></code> | Define a CloudWatch event that triggers when something happens to this repository. |
| <code><a href="#@cloudkitect/components.CkBucket.onCloudTrailPutObject">onCloudTrailPutObject</a></code> | Defines an AWS CloudWatch event that triggers when an object is uploaded to the specified paths (keys) in this bucket using the PutObject API call. |
| <code><a href="#@cloudkitect/components.CkBucket.onCloudTrailWriteObject">onCloudTrailWriteObject</a></code> | Defines an AWS CloudWatch event that triggers when an object at the specified paths (keys) in this bucket are written to. |
| <code><a href="#@cloudkitect/components.CkBucket.s3UrlForObject">s3UrlForObject</a></code> | The S3 URL of an S3 object. For example:. |
| <code><a href="#@cloudkitect/components.CkBucket.transferAccelerationUrlForObject">transferAccelerationUrlForObject</a></code> | The https Transfer Acceleration URL of an S3 object. |
| <code><a href="#@cloudkitect/components.CkBucket.urlForObject">urlForObject</a></code> | The https URL of an S3 object. Specify `regional: false` at the options for non-regional URLs. For example:. |
| <code><a href="#@cloudkitect/components.CkBucket.virtualHostedUrlForObject">virtualHostedUrlForObject</a></code> | The virtual hosted-style URL of an S3 object. Specify `regional: false` at the options for non-regional URL. For example:. |
| <code><a href="#@cloudkitect/components.CkBucket.addCorsRule">addCorsRule</a></code> | Adds a cross-origin access configuration for objects in an Amazon S3 bucket. |
| <code><a href="#@cloudkitect/components.CkBucket.addInventory">addInventory</a></code> | Add an inventory configuration. |
| <code><a href="#@cloudkitect/components.CkBucket.addLifecycleRule">addLifecycleRule</a></code> | Add a lifecycle rule to the bucket. |
| <code><a href="#@cloudkitect/components.CkBucket.addMetric">addMetric</a></code> | Adds a metrics configuration for the CloudWatch request metrics from the bucket. |
---
##### `toString` <a name="toString" id="@cloudkitect/components.CkBucket.toString"></a>
```typescript
public toString(): string
```
Returns a string representation of this construct.
##### `applyRemovalPolicy` <a name="applyRemovalPolicy" id="@cloudkitect/components.CkBucket.applyRemovalPolicy"></a>
```typescript
public applyRemovalPolicy(policy: RemovalPolicy): void
```
Apply the given removal policy to this resource.
The Removal Policy controls what happens to this resource when it stops
being managed by CloudFormation, either because you've removed it from the
CDK application or because you've made a change that requires the resource
to be replaced.
The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS
account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).
###### `policy`<sup>Required</sup> <a name="policy" id="@cloudkitect/components.CkBucket.applyRemovalPolicy.parameter.policy"></a>
- *Type:* aws-cdk-lib.RemovalPolicy
---
##### `addEventNotification` <a name="addEventNotification" id="@cloudkitect/components.CkBucket.addEventNotification"></a>
```typescript
public addEventNotification(event: EventType, dest: IBucketNotificationDestination, filters: NotificationKeyFilter): void
```
Adds a bucket notification event destination.
> [https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html](https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html)
*Example*
```typescript
declare const myLambda: lambda.Function;
const bucket = new s3.Bucket(this, 'MyBucket');
bucket.addEventNotification(s3.EventType.OBJECT_CREATED, new s3n.LambdaDestination(myLambda), {prefix: 'home/myusername/*'});
```
###### `event`<sup>Required</sup> <a name="event" id="@cloudkitect/components.CkBucket.addEventNotification.parameter.event"></a>
- *Type:* aws-cdk-lib.aws_s3.EventType
The event to trigger the notification.
---
###### `dest`<sup>Required</sup> <a name="dest" id="@cloudkitect/components.CkBucket.addEventNotification.parameter.dest"></a>
- *Type:* aws-cdk-lib.aws_s3.IBucketNotificationDestination
The notification destination (Lambda, SNS Topic or SQS Queue).
---
###### `filters`<sup>Required</sup> <a name="filters" id="@cloudkitect/components.CkBucket.addEventNotification.parameter.filters"></a>
- *Type:* aws-cdk-lib.aws_s3.NotificationKeyFilter
S3 object key filter rules to determine which objects trigger this event.
Each filter must include a `prefix` and/or `suffix`
that will be matched against the s3 object key. Refer to the S3 Developer Guide
for details about allowed filter rules.
---
##### `addObjectCreatedNotification` <a name="addObjectCreatedNotification" id="@cloudkitect/components.CkBucket.addObjectCreatedNotification"></a>
```typescript
public addObjectCreatedNotification(dest: IBucketNotificationDestination, filters: NotificationKeyFilter): void
```
Subscribes a destination to receive notifications when an object is created in the bucket.
This is identical to calling
`onEvent(EventType.OBJECT_CREATED)`.
###### `dest`<sup>Required</sup> <a name="dest" id="@cloudkitect/components.CkBucket.addObjectCreatedNotification.parameter.dest"></a>
- *Type:* aws-cdk-lib.aws_s3.IBucketNotificationDestination
The notification destination (see onEvent).
---
###### `filters`<sup>Required</sup> <a name="filters" id="@cloudkitect/components.CkBucket.addObjectCreatedNotification.parameter.filters"></a>
- *Type:* aws-cdk-lib.aws_s3.NotificationKeyFilter
Filters (see onEvent).
---
##### `addObjectRemovedNotification` <a name="addObjectRemovedNotification" id="@cloudkitect/components.CkBucket.addObjectRemovedNotification"></a>
```typescript
public addObjectRemovedNotification(dest: IBucketNotificationDestination, filters: NotificationKeyFilter): void
```
Subscribes a destination to receive notifications when an object is removed from the bucket.
This is identical to calling
`onEvent(EventType.OBJECT_REMOVED)`.
###### `dest`<sup>Required</sup> <a name="dest" id="@cloudkitect/components.CkBucket.addObjectRemovedNotification.parameter.dest"></a>
- *Type:* aws-cdk-lib.aws_s3.IBucketNotificationDestination
The notification destination (see onEvent).
---
###### `filters`<sup>Required</sup> <a name="filters" id="@cloudkitect/components.CkBucket.addObjectRemovedNotification.parameter.filters"></a>
- *Type:* aws-cdk-lib.aws_s3.NotificationKeyFilter
Filters (see onEvent).
---
##### `addToResourcePolicy` <a name="addToResourcePolicy" id="@cloudkitect/components.CkBucket.addToResourcePolicy"></a>
```typescript
public addToResourcePolicy(permission: PolicyStatement): AddToResourcePolicyResult
```
Adds a statement to the resource policy for a principal (i.e. account/role/service) to perform actions on this bucket and/or its contents. Use `bucketArn` and `arnForObjects(keys)` to obtain ARNs for this bucket or objects.
Note that the policy statement may or may not be added to the policy.
For example, when an `IBucket` is created from an existing bucket,
it's not possible to tell whether the bucket already has a policy
attached, let alone to re-use that policy to add more statements to it.
So it's safest to do nothing in these cases.
###### `permission`<sup>Required</sup> <a name="permission" id="@cloudkitect/components.CkBucket.addToResourcePolicy.parameter.permission"></a>
- *Type:* aws-cdk-lib.aws_iam.PolicyStatement
the policy statement to be added to the bucket's policy.
---
##### `arnForObjects` <a name="arnForObjects" id="@cloudkitect/components.CkBucket.arnForObjects"></a>
```typescript
public arnForObjects(keyPattern: string): string
```
Returns an ARN that represents all objects within the bucket that match the key pattern specified.
To represent all keys, specify ``"*"``.
If you need to specify a keyPattern with multiple components, concatenate them into a single string, e.g.:
arnForObjects(`home/${team}/${user}/*`)
###### `keyPattern`<sup>Required</sup> <a name="keyPattern" id="@cloudkitect/components.CkBucket.arnForObjects.parameter.keyPattern"></a>
- *Type:* string
---
##### `enableEventBridgeNotification` <a name="enableEventBridgeNotification" id="@cloudkitect/components.CkBucket.enableEventBridgeNotification"></a>
```typescript
public enableEventBridgeNotification(): void
```
Enables event bridge notification, causing all events below to be sent to EventBridge:.
Object Deleted (DeleteObject)
- Object Deleted (Lifecycle expiration)
- Object Restore Initiated
- Object Restore Completed
- Object Restore Expired
- Object Storage Class Changed
- Object Access Tier Changed
- Object ACL Updated
- Object Tags Added
- Object Tags Deleted
##### `grantDelete` <a name="grantDelete" id="@cloudkitect/components.CkBucket.grantDelete"></a>
```typescript
public grantDelete(identity: IGrantable, objectsKeyPattern?: any): Grant
```
Grants s3:DeleteObject* permission to an IAM principal for objects in this bucket.
###### `identity`<sup>Required</sup> <a name="identity" id="@cloudkitect/components.CkBucket.grantDelete.parameter.identity"></a>
- *Type:* aws-cdk-lib.aws_iam.IGrantable
The principal.
---
###### `objectsKeyPattern`<sup>Optional</sup> <a name="objectsKeyPattern" id="@cloudkitect/components.CkBucket.grantDelete.parameter.objectsKeyPattern"></a>
- *Type:* any
Restrict the permission to a certain key pattern (default '*').
Parameter type is `any` but `string` should be passed in.
---
##### `grantPublicAccess` <a name="grantPublicAccess" id="@cloudkitect/components.CkBucket.grantPublicAccess"></a>
```typescript
public grantPublicAccess(allowedActions: string, keyPrefix?: string): Grant
```
Allows unrestricted access to objects from this bucket.
IMPORTANT: This permission allows anyone to perform actions on S3 objects
in this bucket, which is useful for when you configure your bucket as a
website and want everyone to be able to read objects in the bucket without
needing to authenticate.
Without arguments, this method will grant read ("s3:GetObject") access to
all objects ("*") in the bucket.
The method returns the `iam.Grant` object, which can then be modified
as needed. For example, you can add a condition that will restrict access only
to an IPv4 range like this:
const grant = bucket.grantPublicAccess();
grant.resourceStatement!.addCondition(‘IpAddress’, { “aws:SourceIp”: “54.240.143.0/24” });
Note that if this `IBucket` refers to an existing bucket, possibly not
managed by CloudFormation, this method will have no effect, since it's
impossible to modify the policy of an existing bucket.
###### `allowedActions`<sup>Required</sup> <a name="allowedActions" id="@cloudkitect/components.CkBucket.grantPublicAccess.parameter.allowedActions"></a>
- *Type:* string
the set of S3 actions to allow.
Default is "s3:GetObject".
---
###### `keyPrefix`<sup>Optional</sup> <a name="keyPrefix" id="@cloudkitect/components.CkBucket.grantPublicAccess.parameter.keyPrefix"></a>
- *Type:* string
the prefix of S3 object keys (e.g. `home/*`). Default is "*".
---
##### `grantPut` <a name="grantPut" id="@cloudkitect/components.CkBucket.grantPut"></a>
```typescript
public grantPut(identity: IGrantable, objectsKeyPattern?: any): Grant
```
Grants s3:PutObject* and s3:Abort* permissions for this bucket to an IAM principal.
If encryption is used, permission to use the key to encrypt the contents
of written files will also be granted to the same principal.
###### `identity`<sup>Required</sup> <a name="identity" id="@cloudkitect/components.CkBucket.grantPut.parameter.identity"></a>
- *Type:* aws-cdk-lib.aws_iam.IGrantable
The principal.
---
###### `objectsKeyPattern`<sup>Optional</sup> <a name="objectsKeyPattern" id="@cloudkitect/components.CkBucket.grantPut.parameter.objectsKeyPattern"></a>
- *Type:* any
Restrict the permission to a certain key pattern (default '*').
Parameter type is `any` but `string` should be passed in.
---
##### `grantPutAcl` <a name="grantPutAcl" id="@cloudkitect/components.CkBucket.grantPutAcl"></a>
```typescript
public grantPutAcl(identity: IGrantable, objectsKeyPattern?: string): Grant
```
Grant the given IAM identity permissions to modify the ACLs of objects in the given Bucket.
If your application has the '@aws-cdk/aws-s3:grantWriteWithoutAcl' feature flag set,
calling `grantWrite` or `grantReadWrite` no longer grants permissions to modify the ACLs of the objects;
in this case, if you need to modify object ACLs, call this method explicitly.
###### `identity`<sup>Required</sup> <a name="identity" id="@cloudkitect/components.CkBucket.grantPutAcl.parameter.identity"></a>
- *Type:* aws-cdk-lib.aws_iam.IGrantable
---
###### `objectsKeyPattern`<sup>Optional</sup> <a name="objectsKeyPattern" id="@cloudkitect/components.CkBucket.grantPutAcl.parameter.objectsKeyPattern"></a>
- *Type:* string
---
##### `grantRead` <a name="grantRead" id="@cloudkitect/components.CkBucket.grantRead"></a>
```typescript
public grantRead(identity: IGrantable, objectsKeyPattern?: any): Grant
```
Grant read permissions for this bucket and it's contents to an IAM principal (Role/Group/User).
If encryption is used, permission to use the key to decrypt the contents
of the bucket will also be granted to the same principal.
###### `identity`<sup>Required</sup> <a name="identity" id="@cloudkitect/components.CkBucket.grantRead.parameter.identity"></a>
- *Type:* aws-cdk-lib.aws_iam.IGrantable
The principal.
---
###### `objectsKeyPattern`<sup>Optional</sup> <a name="objectsKeyPattern" id="@cloudkitect/components.CkBucket.grantRead.parameter.objectsKeyPattern"></a>
- *Type:* any
Restrict the permission to a certain key pattern (default '*').
Parameter type is `any` but `string` should be passed in.
---
##### `grantReadWrite` <a name="grantReadWrite" id="@cloudkitect/components.CkBucket.grantReadWrite"></a>
```typescript
public grantReadWrite(identity: IGrantable, objectsKeyPattern?: any): Grant
```
Grants read/write permissions for this bucket and it's contents to an IAM principal (Role/Group/User).
If an encryption key is used, permission to use the key for
encrypt/decrypt will also be granted.
Before CDK version 1.85.0, this method granted the `s3:PutObject*` permission that included `s3:PutObjectAcl`,
which could be used to grant read/write object access to IAM principals in other accounts.
If you want to get rid of that behavior, update your CDK version to 1.85.0 or later,
and make sure the `@aws-cdk/aws-s3:grantWriteWithoutAcl` feature flag is set to `true`
in the `context` key of your cdk.json file.
If you've already updated, but still need the principal to have permissions to modify the ACLs,
use the `grantPutAcl` method.
###### `identity`<sup>Required</sup> <a name="identity" id="@cloudkitect/components.CkBucket.grantReadWrite.parameter.identity"></a>
- *Type:* aws-cdk-lib.aws_iam.IGrantable
---
###### `objectsKeyPattern`<sup>Optional</sup> <a name="objectsKeyPattern" id="@cloudkitect/components.CkBucket.grantReadWrite.parameter.objectsKeyPattern"></a>
- *Type:* any
---
##### `grantWrite` <a name="grantWrite" id="@cloudkitect/components.CkBucket.grantWrite"></a>
```typescript
public grantWrite(identity: IGrantable, objectsKeyPattern?: any, allowedActionPatterns?: string[]): Grant
```
Grant write permissions to this bucket to an IAM principal.
If encryption is used, permission to use the key to encrypt the contents
of written files will also be granted to the same principal.
Before CDK version 1.85.0, this method granted the `s3:PutObject*` permission that included `s3:PutObjectAcl`,
which could be used to grant read/write object access to IAM principals in other accounts.
If you want to get rid of that behavior, update your CDK version to 1.85.0 or later,
and make sure the `@aws-cdk/aws-s3:grantWriteWithoutAcl` feature flag is set to `true`
in the `context` key of your cdk.json file.
If you've already updated, but still need the principal to have permissions to modify the ACLs,
use the `grantPutAcl` method.
###### `identity`<sup>Required</sup> <a name="identity" id="@cloudkitect/components.CkBucket.grantWrite.parameter.identity"></a>
- *Type:* aws-cdk-lib.aws_iam.IGrantable
---
###### `objectsKeyPattern`<sup>Optional</sup> <a name="objectsKeyPattern" id="@cloudkitect/components.CkBucket.grantWrite.parameter.objectsKeyPattern"></a>
- *Type:* any
---
###### `allowedActionPatterns`<sup>Optional</sup> <a name="allowedActionPatterns" id="@cloudkitect/components.CkBucket.grantWrite.parameter.allowedActionPatterns"></a>
- *Type:* string[]
---
##### `onCloudTrailEvent` <a name="onCloudTrailEvent" id="@cloudkitect/components.CkBucket.onCloudTrailEvent"></a>
```typescript
public onCloudTrailEvent(id: string, options?: OnCloudTrailBucketEventOptions): Rule
```
Define a CloudWatch event that triggers when something happens to this repository.
Requires that there exists at least one CloudTrail Trail in your account
that captures the event. This method will not create the Trail.
###### `id`<sup>Required</sup> <a name="id" id="@cloudkitect/components.CkBucket.onCloudTrailEvent.parameter.id"></a>
- *Type:* string
The id of the rule.
---
###### `options`<sup>Optional</sup> <a name="options" id="@cloudkitect/components.CkBucket.onCloudTrailEvent.parameter.options"></a>
- *Type:* aws-cdk-lib.aws_s3.OnCloudTrailBucketEventOptions
Options for adding the rule.
---
##### `onCloudTrailPutObject` <a name="onCloudTrailPutObject" id="@cloudkitect/components.CkBucket.onCloudTrailPutObject"></a>
```typescript
public onCloudTrailPutObject(id: string, options?: OnCloudTrailBucketEventOptions): Rule
```
Defines an AWS CloudWatch event that triggers when an object is uploaded to the specified paths (keys) in this bucket using the PutObject API call.
Note that some tools like `aws s3 cp` will automatically use either
PutObject or the multipart upload API depending on the file size,
so using `onCloudTrailWriteObject` may be preferable.
Requires that there exists at least one CloudTrail Trail in your account
that captures the event. This method will not create the Trail.
###### `id`<sup>Required</sup> <a name="id" id="@cloudkitect/components.CkBucket.onCloudTrailPutObject.parameter.id"></a>
- *Type:* string
The id of the rule.
---
###### `options`<sup>Optional</sup> <a name="options" id="@cloudkitect/components.CkBucket.onCloudTrailPutObject.parameter.options"></a>
- *Type:* aws-cdk-lib.aws_s3.OnCloudTrailBucketEventOptions
Options for adding the rule.
---
##### `onCloudTrailWriteObject` <a name="onCloudTrailWriteObject" id="@cloudkitect/components.CkBucket.onCloudTrailWriteObject"></a>
```typescript
public onCloudTrailWriteObject(id: string, options?: OnCloudTrailBucketEventOptions): Rule
```
Defines an AWS CloudWatch event that triggers when an object at the specified paths (keys) in this bucket are written to.
This includes
the events PutObject, CopyObject, and CompleteMultipartUpload.
Note that some tools like `aws s3 cp` will automatically use either
PutObject or the multipart upload API depending on the file size,
so using this method may be preferable to `onCloudTrailPutObject`.
Requires that there exists at least one CloudTrail Trail in your account
that captures the event. This method will not create the Trail.
###### `id`<sup>Required</sup> <a name="id" id="@cloudkitect/components.CkBucket.onCloudTrailWriteObject.parameter.id"></a>
- *Type:* string
The id of the rule.
---
###### `options`<sup>Optional</sup> <a name="options" id="@cloudkitect/components.CkBucket.onCloudTrailWriteObject.parameter.options"></a>
- *Type:* aws-cdk-lib.aws_s3.OnCloudTrailBucketEventOptions
Options for adding the rule.
---
##### `s3UrlForObject` <a name="s3UrlForObject" id="@cloudkitect/components.CkBucket.s3UrlForObject"></a>
```typescript
public s3UrlForObject(key?: string): string
```
The S3 URL of an S3 object. For example:.
`s3://onlybucket`
- `s3://bucket/key`
###### `key`<sup>Optional</sup> <a name="key" id="@cloudkitect/components.CkBucket.s3UrlForObject.parameter.key"></a>
- *Type:* string
The S3 key of the object.
If not specified, the S3 URL of the
bucket is returned.
---
##### `transferAccelerationUrlForObject` <a name="transferAccelerationUrlForObject" id="@cloudkitect/components.CkBucket.transferAccelerationUrlForObject"></a>
```typescript
public transferAccelerationUrlForObject(key?: string, options?: TransferAccelerationUrlOptions): string
```
The https Transfer Acceleration URL of an S3 object.
Specify `dualStack: true` at the options
for dual-stack endpoint (connect to the bucket over IPv6). For example:
- `https://bucket.s3-accelerate.amazonaws.com`
- `https://bucket.s3-accelerate.amazonaws.com/key`
###### `key`<sup>Optional</sup> <a name="key" id="@cloudkitect/components.CkBucket.transferAccelerationUrlForObject.parameter.key"></a>
- *Type:* string
The S3 key of the object.
If not specified, the URL of the
bucket is returned.
---
###### `options`<sup>Optional</sup> <a name="options" id="@cloudkitect/components.CkBucket.transferAccelerationUrlForObject.parameter.options"></a>
- *Type:* aws-cdk-lib.aws_s3.TransferAccelerationUrlOptions
Options for generating URL.
---
##### `urlForObject` <a name="urlForObject" id="@cloudkitect/components.CkBucket.urlForObject"></a>
```typescript
public urlForObject(key?: string): string
```
The https URL of an S3 object. Specify `regional: false` at the options for non-regional URLs. For example:.
`https://s3.us-west-1.amazonaws.com/onlybucket`
- `https://s3.us-west-1.amazonaws.com/bucket/key`
- `https://s3.cn-north-1.amazonaws.com.cn/china-bucket/mykey`
###### `key`<sup>Optional</sup> <a name="key" id="@cloudkitect/components.CkBucket.urlForObject.parameter.key"></a>
- *Type:* string
The S3 key of the object.
If not specified, the URL of the
bucket is returned.
---
##### `virtualHostedUrlForObject` <a name="virtualHostedUrlForObject" id="@cloudkitect/components.CkBucket.virtualHostedUrlForObject"></a>
```typescript
public virtualHostedUrlForObject(key?: string, options?: VirtualHostedStyleUrlOptions): string
```
The virtual hosted-style URL of an S3 object. Specify `regional: false` at the options for non-regional URL. For example:.
`https://only-bucket.s3.us-west-1.amazonaws.com`
- `https://bucket.s3.us-west-1.amazonaws.com/key`
- `https://bucket.s3.amazonaws.com/key`
- `https://china-bucket.s3.cn-north-1.amazonaws.com.cn/mykey`
###### `key`<sup>Optional</sup> <a name="key" id="@cloudkitect/components.CkBucket.virtualHostedUrlForObject.parameter.key"></a>
- *Type:* string
The S3 key of the object.
If not specified, the URL of the
bucket is returned.
---
###### `options`<sup>Optional</sup> <a name="options" id="@cloudkitect/components.CkBucket.virtualHostedUrlForObject.parameter.options"></a>
- *Type:* aws-cdk-lib.aws_s3.VirtualHostedStyleUrlOptions
Options for generating URL.
---
##### `addCorsRule` <a name="addCorsRule" id="@cloudkitect/components.CkBucket.addCorsRule"></a>
```typescript
public addCorsRule(rule: CorsRule): void
```
Adds a cross-origin access configuration for objects in an Amazon S3 bucket.
###### `rule`<sup>Required</sup> <a name="rule" id="@cloudkitect/components.CkBucket.addCorsRule.parameter.rule"></a>
- *Type:* aws-cdk-lib.aws_s3.CorsRule
The CORS configuration rule to add.
---
##### `addInventory` <a name="addInventory" id="@cloudkitect/components.CkBucket.addInventory"></a>
```typescript
public addInventory(inventory: Inventory): void
```
Add an inventory configuration.
###### `inventory`<sup>Required</sup> <a name="inventory" id="@cloudkitect/components.CkBucket.addInventory.parameter.inventory"></a>
- *Type:* aws-cdk-lib.aws_s3.Inventory
configuration to add.
---
##### `addLifecycleRule` <a name="addLifecycleRule" id="@cloudkitect/components.CkBucket.addLifecycleRule"></a>
```typescript
public addLifecycleRule(rule: LifecycleRule): void
```
Add a lifecycle rule to the bucket.
###### `rule`<sup>Required</sup> <a name="rule" id="@cloudkitect/components.CkBucket.addLifecycleRule.parameter.rule"></a>
- *Type:* aws-cdk-lib.aws_s3.LifecycleRule
The rule to add.
---
##### `addMetric` <a name="addMetric" id="@cloudkitect/components.CkBucket.addMetric"></a>
```typescript
public addMetric(metric: BucketMetrics): void
```
Adds a metrics configuration for the CloudWatch request metrics from the bucket.
###### `metric`<sup>Required</sup> <a name="metric" id="@cloudkitect/components.CkBucket.addMetric.parameter.metric"></a>
- *Type:* aws-cdk-lib.aws_s3.BucketMetrics
The metric configuration to add.
---
#### Static Functions <a name="Static Functions" id="Static Functions"></a>
| **Name** | **Description** |
| --- | --- |
| <code><a href="#@cloudkitect/components.CkBucket.isConstruct">isConstruct</a></code> | Checks if `x` is a construct. |
| <code><a href="#@cloudkitect/components.CkBucket.isOwnedResource">isOwnedResource</a></code> | Returns true if the construct was created by CDK, and false otherwise. |
| <code><a href="#@cloudkitect/components.CkBucket.isResource">isResource</a></code> | Check whether the given construct is a Resource. |
| <code><a href="#@cloudkitect/components.CkBucket.fromBucketArn">fromBucketArn</a></code> | *No description.* |
| <code><a href="#@cloudkitect/components.CkBucket.fromBucketAttributes">fromBucketAttributes</a></code> | Creates a Bucket construct that represents an external bucket. |
| <code><a href="#@cloudkitect/components.CkBucket.fromBucketName">fromBucketName</a></code> | *No description.* |
| <code><a href="#@cloudkitect/components.CkBucket.fromCfnBucket">fromCfnBucket</a></code> | Create a mutable `IBucket` based on a low-level `CfnBucket`. |
| <code><a href="#@cloudkitect/components.CkBucket.validateBucketName">validateBucketName</a></code> | Thrown an exception if the given bucket name is not valid. |
---
##### `isConstruct` <a name="isConstruct" id="@cloudkitect/components.CkBucket.isConstruct"></a>
```typescript
import { CkBucket } from '@cloudkitect/components'
CkBucket.isConstruct(x: any)
```
Checks if `x` is a construct.
Use this method instead of `instanceof` to properly detect `Construct`
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the `constructs` library on
disk are seen as independent, completely different libraries. As a
consequence, the class `Construct` in each copy of the `constructs` library
is seen as a different class, and an instance of one class will not test as
`instanceof` the other class. `npm install` will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the `constructs`
library can be accidentally installed, and `instanceof` will behave
unpredictably. It is safest to avoid using `instanceof`, and using
this type-testing method instead.
###### `x`<sup>Required</sup> <a name="x" id="@cloudkitect/components.CkBucket.isConstruct.parameter.x"></a>
- *Type:* any
Any object.
---
##### `isOwnedResource` <a name="isOwnedResource" id="@cloudkitect/components.CkBucket.isOwnedResource"></a>
```typescript
import { CkBucket } from '@cloudkitect/components'
CkBucket.isOwnedResource(construct: IConstruct)
```
Returns true if the construct was created by CDK, and false otherwise.
###### `construct`<sup>Required</sup> <a name="construct" id="@cloudkitect/components.CkBucket.isOwnedResource.parameter.construct"></a>
- *Type:* constructs.IConstruct
---
##### `isResource` <a name="isResource" id="@cloudkitect/components.CkBucket.isResource"></a>
```typescript
import { CkBucket } from '@cloudkitect/components'
CkBucket.isResource(construct: IConstruct)
```
Check whether the given construct is a Resource.
###### `construct`<sup>Required</sup> <a name="construct" id="@cloudkitect/components.CkBucket.isResource.parameter.construct"></a>
- *Type:* constructs.IConstruct
---
##### `fromBucketArn` <a name="fromBucketArn" id="@cloudkitect/components.CkBucket.fromBucketArn"></a>
```typescript
import { CkBucket } from '@cloudkitect/components'
CkBucket.fromBucketArn(scope: Construct, id: string, bucketArn: string)
```
###### `scope`<sup>Required</sup> <a name="scope" id="@cloudkitect/components.CkBucket.fromBucketArn.parameter.scope"></a>
- *Type:* constructs.Construct
---
###### `id`<sup>Required</sup> <a name="id" id="@cloudkitect/components.CkBucket.fromBucketArn.parameter.id"></a>
- *Type:* string
---
###### `bucketArn`<sup>Required</sup> <a name="bucketArn" id="@cloudkitect/components.CkBucket.fromBucketArn.parameter.bucketArn"></a>
- *Type:* string
---
##### `fromBucketAttributes` <a name="fromBucketAttributes" id="@cloudkitect/components.CkBucket.fromBucketAttributes"></a>
```typescript
import { CkBucket } from '@cloudkitect/components'
CkBucket.fromBucketAttributes(scope: Construct, id: string, attrs: BucketAttributes)
```
Creates a Bucket construct that represents an external bucket.
###### `scope`<sup>Required</sup> <a name="scope" id="@cloudkitect/components.CkBucket.fromBucketAttributes.parameter.scope"></a>
- *Type:* constructs.Construct
The parent creating construct (usually `this`).
---
###### `id`<sup>Required</sup> <a name="id" id="@cloudkitect/components.CkBucket.fromBucketAttributes.parameter.id"></a>
- *Type:* string
The construct's name.
---
###### `attrs`<sup>Required</sup> <a name="attrs" id="@cloudkitect/components.CkBucket.fromBucketAttributes.parameter.attrs"></a>
- *Type:* aws-cdk-lib.aws_s3.BucketAttributes
A `BucketAttributes` object.
Can be obtained from a call to
`bucket.export()` or manually created.
---
##### `fromBucketName` <a name="fromBucketName" id="@cloudkitect/components.CkBucket.fromBucketName"></a>
```typescript
import { CkBucket } from '@cloudkitect/components'
CkBucket.fromBucketName(scope: Construct, id: string, bucketName: string)
```
###### `scope`<sup>Required</sup> <a name="scope" id="@cloudkitect/components.CkBucket.fromBucketName.parameter.scope"></a>
- *Type:* constructs.Construct
---
###### `id`<sup>Required</sup> <a name="id" id="@cloudkitect/components.CkBucket.fromBucketName.parameter.id"></a>
- *Type:* string
---
###### `bucketName`<sup>Required</sup> <a name="bucketName" id="@cloudkitect/components.CkBucket.fromBucketName.parameter.bucketName"></a>
- *Type:* string
---
##### `fromCfnBucket` <a name="fromCfnBucket" id="@cloudkitect/components.CkBucket.fromCfnBucket"></a>
```typescript
import { CkBucket } from '@cloudkitect/components'
CkBucket.fromCfnBucket(cfnBucket: CfnBucket)
```
Create a mutable `IBucket` based on a low-level `CfnBucket`.
###### `cfnBucket`<sup>Required</sup> <a name="cfnBucket" id="@cloudkitect/components.CkBucket.fromCfnBucket.parameter.cfnBucket"></a>
- *Type:* aws-cdk-lib.aws_s3.CfnBucket
---
##### `validateBucketName` <a name="validateBucketName" id="@cloudkitect/components.CkBucket.validateBucketName"></a>
```typescript
import { CkBucket } from '@cloudkitect/components'
CkBucket.validateBucketName(physicalName: string)
```
Thrown an exception if the given bucket name is not valid.
###### `physicalName`<sup>Required</sup> <a name="physicalName" id="@cloudkitect/components.CkBucket.validateBucketName.parameter.physicalName"></a>
- *Type:* string
name of the bucket.
---
#### Properties <a name="Properties" id="Properties"></a>
| **Name** | **Type** | **Description** |
| --- | --- | --- |
| <code><a href="#@cloudkitect/components.CkBucket.property.node">node</a></code> | <code>constructs.Node</code> | The tree node. |
| <code><a href="#@cloudkitect/components.CkBucket.property.env">env</a></code> | <code>aws-cdk-lib.ResourceEnvironment</code> | The environment this resource belongs to. |
| <code><a href="#@cloudkitect/components.CkBucket.property.stack">stack</a></code> | <code>aws-cdk-lib.Stack</code> | The stack in which this resource is defined. |
| <code><a href="#@cloudkitect/components.CkBucket.property.bucketArn">bucketArn</a></code> | <code>string</code> | The ARN of the bucket. |
| <code><a href="#@cloudkitect/components.CkBucket.property.bucketDomainName">bucketDomainName</a></code> | <code>string</code> | The IPv4 DNS name of the specified bucket. |
| <code><a href="#@cloudkitect/components.CkBucket.property.bucketDualStackDomainName">bucketDualStackDomainName</a></code> | <code>string</code> | The IPv6 DNS name of the specified bucket. |
| <code><a href="#@cloudkitect/components.CkBucket.property.bucketName">bucketName</a></code> | <code>string</code> | The name of the bucket. |
| <code><a href="#@cloudkitect/components.CkBucket.property.bucketRegionalDomainName">bucketRegionalDomainName</a></code> | <code>string</code> | The regional domain name of the specified bucket. |
| <code><a href="#@cloudkitect/components.CkBucket.property.bucketWebsiteDomainName">bucketWebsiteDomainName</a></code> | <code>string</code> | The Domain name of the static website. |
| <code><a href="#@cloudkitect/components.CkBucket.property.bucketWebsiteUrl">bucketWebsiteUrl</a></code> | <code>string</code> | The URL of the static website. |
| <code><a href="#@cloudkitect/components.CkBucket.property.encryptionKey">encryptionKey</a></code> | <code>aws-cdk-lib.aws_kms.IKey</code> | Optional KMS encryption key associated with this bucket. |
| <code><a href="#@cloudkitect/components.CkBucket.property.isWebsite">isWebsite</a></code> | <code>boolean</code> | If this bucket has been configured for static website hosting. |
| <code><a href="#@cloudkitect/components.CkBucket.property.policy">policy</a></code> | <code>aws-cdk-lib.aws_s3.BucketPolicy</code> | The resource policy associated with this bucket. |
---
##### `node`<sup>Required</sup> <a name="node" id="@cloudkitect/components.CkBucket.property.node"></a>
```typescript
public readonly node: Node;
```
- *Type:* constructs.Node
The tree node.
---
##### `env`<sup>Required</sup> <a name="env" id="@cloudkitect/components.CkBucket.property.env"></a>
```typescript
public readonly env: ResourceEnvironment;
```
- *Type:* aws-cdk-lib.ResourceEnvironment
The environment this resource belongs to.
For resources that are created and managed by the CDK
(generally, those created by creating new class instances like Role, Bucket, etc.),
this is always the same as the environment of the stack they belong to;
however, for imported resources
(those obtained from static methods like fromRoleArn, fromBucketName, etc.),
that might be different than the stack they were imported into.
---
##### `stack`<sup>Required</sup> <a name="stack" id="@cloudkitect/components.CkBucket.property.stack"></a>
```typescript
public readonly stack: Stack;
```
- *Type:* aws-cdk-lib.Stack
The stack in which this resource is defined.
---
##### `bucketArn`<sup>Required</sup> <a name="bucketArn" id="@cloudkitect/components.CkBucket.property.bucketArn"></a>
```typescript
public readonly bucketArn: string;
```
- *Type:* string
The ARN of the bucket.
---
##### `bucketDomainName`<sup>Required</sup> <a name="bucketDomainName" id="@cloudkitect/components.CkBucket.property.bucketDomainName"></a>
```typescript
public readonly bucketDomainName: string;
```
- *Type:* string
The IPv4 DNS name of the specified bucket.
---
##### `bucketDualStackDomainName`<sup>Required</sup> <a name="bucketDualStackDomainName" id="@cloudkitect/components.CkBucket.property.bucketDualStackDomainName"></a>
```typescript
public readonly bucketDualStackDomainName: string;
```
- *Type:* string
The IPv6 DNS name of the specified bucket.
---
##### `bucketName`<sup>Required</sup> <a name="bucketName" id="@cloudkitect/components.CkBucket.property.bucketName"></a>
```typescript
public readonly bucketName: string;
```
- *Type:* string
The name of the bucket.
---
##### `bucketRegionalDomainName`<sup>Required</sup> <a name="bucketRegionalDomainName" id="@cloudkitect/components.CkBucket.property.bucketRegionalDomainName"></a>
```typescript
public readonly bucketRegionalDomainName: string;
```
- *Type:* string
The regional domain name of the specified bucket.
---
##### `bucketWebsiteDomainName`<sup>Required</sup> <a name="bucketWebsiteDomainName" id="@cloudkitect/components.CkBucket.property.bucketWebsiteDomainName"></a>
```typescript
public readonly bucketWebsiteDomainName: string;
```
- *Type:* string
The Domain name of the static website.
---
##### `bucketWebsiteUrl`<sup>Required</sup> <a name="bucketWebsiteUrl" id="@cloudkitect/components.CkBucket.property.bucketWebsiteUrl"></a>
```typescript
public readonly bucketWebsiteUrl: string;
```
- *Type:* string
The URL of the static website.
---
##### `encryptionKey`<sup>Optional</sup> <a name="encryptionKey" id="@cloudkitect/components.CkBucket.property.encryptionKey"></a>
```typescript
public readonly encryptionKey: IKey;
```
- *Type:* aws-cdk-lib.aws_kms.IKey
Optional KMS encryption key associated with this bucket.
---
##### `isWebsite`<sup>Optional</sup> <a name="isWebsite" id="@cloudkitect/components.CkBucket.property.isWebsite"></a>
```typescript
public readonly isWebsite: boolean;
```
- *Type:* boolean
If this bucket has been configured for static website hosting.
---
##### `policy`<sup>Optional</sup> <a name="policy" id="@cloudkitect/components.CkBucket.property.policy"></a>
```typescript
public readonly policy: BucketPolicy;
```
- *Type:* aws-cdk-lib.aws_s3.BucketPolicy
The resource policy associated with this bucket.
If `autoCreatePolicy` is true, a `BucketPolicy` will be created upon the
first call to addToResourcePolicy(s).
---
### CkCluster <a name="CkCluster" id="@cloudkitect/components.CkCluster"></a>
CloudKitect ECS cluster component is a regional grouping of one or more container instances on which you can run tasks and services and enables container insights, ### Default Configuration New VPC is created by default.
### Default Alarms
Available only in Enhanced components
### Logging and Monitoring
Available only in Enhanced components
### Examples
Default Usage
```ts
new CkCluster(this, "LogicalId", {});
```
Custom Configuration
```ts
new CkCluster(this, "LogicalId", {
containerInsights: false
});
```
### Compliance
It addresses the following compliance requirements
#### Initializers <a name="Initializers" id="@cloudkitect/components.CkCluster.Initializer"></a>
```typescript
import { CkCluster } from '@cloudkitect/components'
new CkCluster(scope: Construct, id: string, props: CkClusterProps)
```
| **Name** | **Type** | **Description** |
| --- | --- | --- |
| <code><a href="#@cloudkitect/components.CkCluster.Initializer.parameter.scope">scope</a></code> | <code>constructs.Construct</code> | *No description.* |
| <code><a href="#@cloudkitect/components.CkCluster.Initializer.parameter.id">id</a></code> | <code>string</code> | *No description.* |
| <code><a href="#@cloudkitect/components.CkCluster.Initializer.parameter.props">props</a></code> | <code><a href="#@cloudkitect/components.CkClusterProps">CkClusterProps</a></code> | *No description.* |
---
##### `scope`<sup>Required</sup> <a name="scope" id="@cloudkitect/components.CkCluster.Initializer.parameter.scope"></a>
- *Type:* constructs.Construct
---
##### `id`<sup>Required</sup> <a name="id" id="@cloudkitect/components.CkCluster.Initializer.parameter.id"></a>
- *Type:* string
---
##### `props`<sup>Required</sup> <a name="props" id="@cloudkitect/components.CkCluster.Initializer.parameter.props"></a>
- *Type:* <a href="#@cloudkitect/components.CkClusterProps">CkClusterProps</a>
---
#### Methods <a name="Methods" id="Methods"></a>
| **Name** | **Description** |
| --- | --- |
| <code><a href="#@cloudkitect/components.CkCluster.toString">toString</a></code> | Returns a string representation of this construct. |
| <code><a href="#@cloudkitect/components.CkCluster.applyRemovalPolicy">applyRemovalPolicy</a></code> | Apply the given removal policy to this resource. |
| <code><a href="#@cloudkitect/components.CkCluster.addAsgCapacityProvider">addAsgCapacityProvider</a></code> | This method adds an Auto Scaling Group Capacity Provider to a cluster. |
| <code><a href="#@cloudkitect/components.CkCluster.addCapacity">addCapacity</a></code> | It is highly recommended to use `Cluster.addAsgCapacityProvider` instead of this method. |
| <code><a href="#@cloudkitect/components.CkCluster.addDefaultCapacityProviderStrategy">addDefaultCapacityProviderStrategy</a></code> | Add default capacity provider strategy for this cluster. |
| <code><a href="#@cloudkitect/components.CkCluster.addDefaultCloudMapNamespace">addDefaultCloudMapNamespace</a></code> | Add an AWS Cloud Map DNS namespace for this cluster. |
| <code><a href="#@cloudkitect/components.CkCluster.arnForTasks">arnForTasks</a></code> | Returns an ARN that represents all tasks within the cluster that match the task pattern specified. |
| <code><a href="#@cloudkitect/components.CkCluster.enableFargateCapacityProviders">enableFargateCapacityProviders</a></code> | Enable the Fargate capacity providers for this cluster. |
| <code><a href="#@cloudkitect/components.CkCluster.grantTaskProtection">grantTaskProtection</a></code> | Grants an ECS Task Protection API permission to the specified grantee. |
| <code><a href="#@cloudkitect/components.CkCluster.metric">metric</a></code> | This method returns the specifed CloudWatch metric for this cluster. |
| <code><a href="#@cloudkitect/components.CkCluster.metricCpuReservation">metricCpuReservation</a></code> | This method returns the CloudWatch metric for this clusters CPU reservation. |
| <code><a href="#@cloudkitect/components.CkCluster.metricCpuUtilization">metricCpuUtilization</a></code> | This method returns the CloudWatch metric for this clusters CPU utilization. |
| <code><a href="#@cloudkitect/components.CkCluster.metricMemoryReservation">metricMemoryReservation</a></code> | This method returns the CloudWatch metric for this clusters memory reservation. |
| <code><a href="#@cloudkitect/components.CkCluster.metricMemoryUtilization">metricMemoryUtilization</a></code> | This method returns the CloudWatch metric for this clusters memory utilization. |
---
##### `toString` <a name="toString" id="@cloudkitect/components.CkCluster.toString"></a>
```typescript
public toString(): string
```
Returns a string representation of this construct.
##### `applyRemovalPolicy` <a name="applyRemovalPolicy" id="@cloudkitect/components.CkCluster.applyRemovalPolicy"></a>
```typescript
public applyRemovalPolicy(policy: RemovalPolicy): void
```
Apply the given removal policy to this resource.
The Removal Policy controls what happens to this resource when it stops
being managed by CloudFormation, either because you've removed it from the
CDK application or because you've made a change that requires the resource
to be replaced.
The resource can be deleted (`RemovalPolicy.DESTROY`), or left in your AWS
account for data recovery and cleanup later (`RemovalPolicy.RETAIN`).
###### `policy`<sup>Required</sup> <a name="policy" id="@cloudkitect/components.CkCluster.applyRemovalPolicy.parameter.policy"></a>
- *Type:* aws-cdk-lib.RemovalPolicy
---
##### `addAsgCapacityProvider` <a name="addAsgCapacityProvider" id="@cloudkitect/components.CkCluster.addAsgCapacityProvider"></a>
```typescript
public addAsgCapacityProvider(provider: AsgCapacityProvider, options?: AddAutoScalingGroupCapacityOptions): void
```
This method adds an Auto Scaling Group Capacity Provider to a cluster.
###### `provider`<sup>Required</sup> <a name="provider" id="@cloudkitect/components.CkCluster.addAsgCapacityProvider.parameter.provider"></a>
- *Type:* aws-cdk-lib.aws_ecs.AsgCapacityProvider
the capacity provider to add to this cluster.
---
###### `options`<sup>Optional</sup> <a name="options" id="@cloudkitect/components.CkCluster.addAsgCapacityProvider.parameter.options"></a>
- *Type:* aws-cdk-lib.aws_ecs.AddAutoScalingGroupCapacityOptions
---
##### `addCapacity` <a name="addCapacity" id="@cloudkitect/components.CkCluster.addCapacity"></a>
```typescript
public