class MemoryBase
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.Bedrock.Agentcore.Alpha.MemoryBase |
Go | github.com/aws/aws-cdk-go/awsbedrockagentcorealpha/v2#MemoryBase |
Java | software.amazon.awscdk.services.bedrock.agentcore.alpha.MemoryBase |
Python | aws_cdk.aws_bedrock_agentcore_alpha.MemoryBase |
TypeScript (source) | @aws-cdk/aws-bedrock-agentcore-alpha ยป MemoryBase |
Implements
IConstruct, IDependable, IResource, IEnvironment, IMemory, IGrantable
Extends
Resource
Implemented by
Memory
Abstract base class for a Memory.
Contains methods and attributes valid for Memories either created with CDK or imported.
Initializer
new MemoryBase(scope: Construct, id: string)
Parameters
- scope
Construct - id
string
Properties
| Name | Type | Description |
|---|---|---|
| env | Resource | The environment this resource belongs to. |
| grant | IPrincipal | The principal to grant permissions to. |
| memory | string | The ARN of the memory resource. |
| memory | string | The id of the memory. |
| node | Node | The tree node. |
| stack | Stack | The stack in which this resource is defined. |
| created | string | Timestamp when the memory was created. |
| execution | IRole | The IAM role that provides permissions for the memory to access AWS services. |
| kms | IKey | Custom KMS key for encryption (if provided). |
| status? | string | The status of the memory. |
| updated | string | Timestamp when the memory was last updated. |
env
Type:
Resource
The environment this resource belongs to.
For resources that are created and managed in a Stack (those created by
creating new class instances like new Role(), new Bucket(), etc.), this
is always the same as the environment of the stack they belong to.
For referenced resources (those obtained from referencing methods like
Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be
different than the stack they were imported into.
grantPrincipal
Type:
IPrincipal
The principal to grant permissions to.
memoryArn
Type:
string
The ARN of the memory resource.
memoryId
Type:
string
The id of the memory.
node
Type:
Node
The tree node.
stack
Type:
Stack
The stack in which this resource is defined.
createdAt?
Type:
string
(optional)
Timestamp when the memory was created.
executionRole?
Type:
IRole
(optional)
The IAM role that provides permissions for the memory to access AWS services.
kmsKey?
Type:
IKey
(optional)
Custom KMS key for encryption (if provided).
status?
Type:
string
(optional)
The status of the memory.
updatedAt?
Type:
string
(optional)
Timestamp when the memory was last updated.
Methods
| Name | Description |
|---|---|
| apply | Apply the given removal policy to this resource. |
| grant(grantee, ...actions) | Grants IAM actions to the IAM Principal. |
| grant | Grant the given principal identity permissions to manage the control plane of this memory. |
| grant | Grant the given principal identity permissions to delete content on this memory. |
| grant | Grant the given principal identity permissions to delete Long-Term Memory (LTM) content on this memory. |
| grant | Grant the given principal identity permissions to delete Short-Term Memory (STM) content on this memory. |
| grant | Grant the given principal identity permissions to do every action on this memory. |
| grant | Grant the given principal identity permissions to read the contents of this memory. |
| grant | Grant the given principal identity permissions to read the Long-Term Memory (LTM) contents of this memory. |
| grant | Grant the given principal identity permissions to read the Short-Term Memory (STM) contents of this memory. |
| grant | Grant the given principal identity permissions to write content to short-term memory. |
| metric(metricName, dimensions, props?) | Return the given named metric for this memory. |
| metric | Return a metric containing the number of errors for a specific API operation performed on this memory. |
| metric | Returns the metric containing the number of short-term memory events. |
| metric | Return the given named metric related to the API operation performed on this memory. |
| metric | Return a metric containing the total number of API requests made for a specific memory operation like CreateEvent, ListEvents, RetrieveMemoryRecords ... |
| metric | Return a metric measuring the latency of a specific API operation performed on this memory. |
| metric | Returns the metric containing the number of long-term memory records created by the long-term extraction strategies. |
| to | Returns a string representation of this construct. |
applyRemovalPolicy(policy)
public applyRemovalPolicy(policy: RemovalPolicy): void
Parameters
- policy
RemovalPolicy
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).
grant(grantee, ...actions)
public grant(grantee: IGrantable, ...actions: string[]): Grant
Parameters
- grantee
IGrantableโ - The IAM principal to grant permissions to. - actions
stringโ - The actions to grant.
Returns
Grants IAM actions to the IAM Principal.
grantAdmin(grantee)
public grantAdmin(grantee: IGrantable): Grant
Parameters
- grantee
IGrantableโ - The IAM principal to grant admin permissions to.
Returns
Grant the given principal identity permissions to manage the control plane of this memory.
grantDelete(grantee)
public grantDelete(grantee: IGrantable): Grant
Parameters
- grantee
IGrantableโ - The IAM principal to grant delete permissions to.
Returns
Grant the given principal identity permissions to delete content on this memory.
Both Short-Term Memory (STM) and Long-Term Memory (LTM).
grantDeleteLongTermMemory(grantee)
public grantDeleteLongTermMemory(grantee: IGrantable): Grant
Parameters
- grantee
IGrantableโ - The IAM principal to grant delete permissions to.
Returns
Grant the given principal identity permissions to delete Long-Term Memory (LTM) content on this memory.
grantDeleteShortTermMemory(grantee)
public grantDeleteShortTermMemory(grantee: IGrantable): Grant
Parameters
- grantee
IGrantableโ - The IAM principal to grant delete permissions to.
Returns
Grant the given principal identity permissions to delete Short-Term Memory (STM) content on this memory.
grantFullAccess(grantee)
public grantFullAccess(grantee: IGrantable): Grant
Parameters
- grantee
IGrantableโ - The IAM principal to grant full access permissions to.
Returns
Grant the given principal identity permissions to do every action on this memory.
grantRead(grantee)
public grantRead(grantee: IGrantable): Grant
Parameters
- grantee
IGrantableโ - The IAM principal to grant read permissions to.
Returns
Grant the given principal identity permissions to read the contents of this memory.
Both Short-Term Memory (STM) and Long-Term Memory (LTM).
grantReadLongTermMemory(grantee)
public grantReadLongTermMemory(grantee: IGrantable): Grant
Parameters
- grantee
IGrantableโ - The IAM principal to grant read permissions to.
Returns
Grant the given principal identity permissions to read the Long-Term Memory (LTM) contents of this memory.
grantReadShortTermMemory(grantee)
public grantReadShortTermMemory(grantee: IGrantable): Grant
Parameters
- grantee
IGrantableโ - The IAM principal to grant read permissions to.
Returns
Grant the given principal identity permissions to read the Short-Term Memory (STM) contents of this memory.
grantWrite(grantee)
public grantWrite(grantee: IGrantable): Grant
Parameters
- grantee
IGrantableโ - The IAM principal to grant read permissions to.
Returns
Grant the given principal identity permissions to write content to short-term memory.
metric(metricName, dimensions, props?)
public metric(metricName: string, dimensions: { [string]: string }, props?: MetricOptions): Metric
Parameters
- metricName
string - dimensions
{ [string]: string } - props
MetricOptions
Returns
Return the given named metric for this memory.
By default, the metric will be calculated as a sum over a period of 5 minutes.
You can customize this by using the statistic and period properties.
metricErrorsForApiOperation(operation, props?)
public metricErrorsForApiOperation(operation: string, props?: MetricOptions): Metric
Parameters
- operation
string - props
MetricOptions
Returns
Return a metric containing the number of errors for a specific API operation performed on this memory.
metricEventCreationCount(props?)
public metricEventCreationCount(props?: MetricOptions): Metric
Parameters
- props
MetricOptions
Returns
Returns the metric containing the number of short-term memory events.
metricForApiOperation(metricName, operation, props?)
public metricForApiOperation(metricName: string, operation: string, props?: MetricOptions): Metric
Parameters
- metricName
string - operation
string - props
MetricOptions
Returns
Return the given named metric related to the API operation performed on this memory.
metricInvocationsForApiOperation(operation, props?)
public metricInvocationsForApiOperation(operation: string, props?: MetricOptions): Metric
Parameters
- operation
string - props
MetricOptions
Returns
Return a metric containing the total number of API requests made for a specific memory operation like CreateEvent, ListEvents, RetrieveMemoryRecords ...
metricLatencyForApiOperation(operation, props?)
public metricLatencyForApiOperation(operation: string, props?: MetricOptions): Metric
Parameters
- operation
string - props
MetricOptions
Returns
Return a metric measuring the latency of a specific API operation performed on this memory.
The latency metric represents the total time elapsed between receiving the request and sending the final response token, measuring complete end-to-end processing time.
For memory creation events specifically, this measures the time from the last CreateEvent that met strategy criteria until memory storage is completed.
metricMemoryRecordCreationCount(props?)
public metricMemoryRecordCreationCount(props?: MetricOptions): Metric
Parameters
- props
MetricOptions
Returns
Returns the metric containing the number of long-term memory records created by the long-term extraction strategies.
toString()
public toString(): string
Returns
string
Returns a string representation of this construct.

.NET
Go
Java
Python
TypeScript (