Skip to content

Commit 78e3ed2

Browse files
authored
feat(construct): add cloudwatch dashboard for bedrock (#651)
* feat(construct): add cloudwatch dashboard for bedrock
1 parent 01ca3ef commit 78e3ed2

File tree

9 files changed

+906
-0
lines changed

9 files changed

+906
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ The following constructs are available in the library:
107107
| [SageMaker model deployment (Custom)](./src/patterns/gen-ai/aws-model-deployment-sagemaker/README_custom_sagemaker_endpoint.md) | Deploy a foundation model from an S3 location to an Amazon SageMaker endpoint. | Amazon SageMaker |
108108
| [Content Generation](./src/patterns/gen-ai/aws-contentgen-appsync-lambda/README.md) | Generate images from text using Amazon titan-image-generator-v1 or stability.stable-diffusion-xl model. | AWS Lambda, Amazon Bedrock, AWS AppSync |
109109
| [Web crawler](./src/patterns/gen-ai/aws-web-crawler/README.md) | Crawl websites and RSS feeds on a schedule and store changeset data in an Amazon Simple Storage Service bucket. | AWS Lambda, AWS Batch, AWS Fargate, Amazon DynamoDB |
110+
| [Amazon Bedrock Monitoring (Amazon CloudWatch Dashboard)](./src/patterns/gen-ai/aws-bedrock-cw-dashboard/README.md) | Amazon CloudWatch dashboard to monitor model usage from Amazon Bedrock. | Amazon CloudWatch |
110111

111112
### L2 Constructs
112113

apidocs/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
## Classes
2121

2222
- [BaseClass](classes/BaseClass.md)
23+
- [BedrockCwDashboard](classes/BedrockCwDashboard.md)
2324
- [ContainerImage](classes/ContainerImage.md)
2425
- [ContentGenerationAppSyncLambda](classes/ContentGenerationAppSyncLambda.md)
2526
- [CustomSageMakerEndpoint](classes/CustomSageMakerEndpoint.md)
@@ -39,6 +40,7 @@
3940

4041
- [AsyncInferenceConfig](interfaces/AsyncInferenceConfig.md)
4142
- [BaseClassProps](interfaces/BaseClassProps.md)
43+
- [BedrockCwDashboardProps](interfaces/BedrockCwDashboardProps.md)
4244
- [ContainerImageConfig](interfaces/ContainerImageConfig.md)
4345
- [ContentGenerationAppSyncLambdaProps](interfaces/ContentGenerationAppSyncLambdaProps.md)
4446
- [CrawlerTarget](interfaces/CrawlerTarget.md)
@@ -51,6 +53,7 @@
5153
- [JumpStartSageMakerEndpointProps](interfaces/JumpStartSageMakerEndpointProps.md)
5254
- [LangchainLayerProps](interfaces/LangchainLayerProps.md)
5355
- [LangchainProps](interfaces/LangchainProps.md)
56+
- [ModelMonitoringProps](interfaces/ModelMonitoringProps.md)
5457
- [QaAppsyncOpensearchProps](interfaces/QaAppsyncOpensearchProps.md)
5558
- [RagAppsyncStepfnOpensearchProps](interfaces/RagAppsyncStepfnOpensearchProps.md)
5659
- [SummarizationAppsyncStepfnProps](interfaces/SummarizationAppsyncStepfnProps.md)

apidocs/classes/BedrockCwDashboard.md

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
[**@cdklabs/generative-ai-cdk-constructs**](../README.md)**Docs**
2+
3+
***
4+
5+
[@cdklabs/generative-ai-cdk-constructs](../README.md) / BedrockCwDashboard
6+
7+
# Class: BedrockCwDashboard
8+
9+
The BedrockCwDashboard class.
10+
11+
## Extends
12+
13+
- `Construct`
14+
15+
## Constructors
16+
17+
### new BedrockCwDashboard()
18+
19+
> **new BedrockCwDashboard**(`scope`, `id`, `props`): [`BedrockCwDashboard`](BedrockCwDashboard.md)
20+
21+
Constructs a new instance of the BedrockCwDashboard class.
22+
23+
#### Parameters
24+
25+
**scope**: `Construct`
26+
27+
represents the scope for all the resources.
28+
29+
**id**: `string`
30+
31+
this is a a scope-unique id.
32+
33+
**props**: [`BedrockCwDashboardProps`](../interfaces/BedrockCwDashboardProps.md)
34+
35+
user provided props for the construct.
36+
37+
#### Returns
38+
39+
[`BedrockCwDashboard`](BedrockCwDashboard.md)
40+
41+
#### Since
42+
43+
0.0.0
44+
45+
#### Overrides
46+
47+
`Construct.constructor`
48+
49+
## Properties
50+
51+
### dashboard
52+
53+
> `readonly` **dashboard**: `Dashboard`
54+
55+
Returns the instance of CloudWatch dashboard used by the construct
56+
57+
***
58+
59+
### node
60+
61+
> `readonly` **node**: `Node`
62+
63+
The tree node.
64+
65+
#### Inherited from
66+
67+
`Construct.node`
68+
69+
## Methods
70+
71+
### addAllModelsMonitoring()
72+
73+
> **addAllModelsMonitoring**(`props`): `void`
74+
75+
#### Parameters
76+
77+
**props**: [`ModelMonitoringProps`](../interfaces/ModelMonitoringProps.md)
78+
79+
#### Returns
80+
81+
`void`
82+
83+
***
84+
85+
### addModelMonitoring()
86+
87+
> **addModelMonitoring**(`modelName`, `modelId`, `props`): `void`
88+
89+
#### Parameters
90+
91+
**modelName**: `string`
92+
93+
**modelId**: `string`
94+
95+
**props**: [`ModelMonitoringProps`](../interfaces/ModelMonitoringProps.md)
96+
97+
#### Returns
98+
99+
`void`
100+
101+
***
102+
103+
### toString()
104+
105+
> **toString**(): `string`
106+
107+
Returns a string representation of this construct.
108+
109+
#### Returns
110+
111+
`string`
112+
113+
#### Inherited from
114+
115+
`Construct.toString`
116+
117+
***
118+
119+
### isConstruct()
120+
121+
> `static` **isConstruct**(`x`): `x is Construct`
122+
123+
Checks if `x` is a construct.
124+
125+
Use this method instead of `instanceof` to properly detect `Construct`
126+
instances, even when the construct library is symlinked.
127+
128+
Explanation: in JavaScript, multiple copies of the `constructs` library on
129+
disk are seen as independent, completely different libraries. As a
130+
consequence, the class `Construct` in each copy of the `constructs` library
131+
is seen as a different class, and an instance of one class will not test as
132+
`instanceof` the other class. `npm install` will not create installations
133+
like this, but users may manually symlink construct libraries together or
134+
use a monorepo tool: in those cases, multiple copies of the `constructs`
135+
library can be accidentally installed, and `instanceof` will behave
136+
unpredictably. It is safest to avoid using `instanceof`, and using
137+
this type-testing method instead.
138+
139+
#### Parameters
140+
141+
**x**: `any`
142+
143+
Any object
144+
145+
#### Returns
146+
147+
`x is Construct`
148+
149+
true if `x` is an object created from a class which extends `Construct`.
150+
151+
#### Inherited from
152+
153+
`Construct.isConstruct`
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
[**@cdklabs/generative-ai-cdk-constructs**](../README.md)**Docs**
2+
3+
***
4+
5+
[@cdklabs/generative-ai-cdk-constructs](../README.md) / BedrockCwDashboardProps
6+
7+
# Interface: BedrockCwDashboardProps
8+
9+
The properties for the BedrockCwDashboardProps class.
10+
11+
## Properties
12+
13+
### dashboardName?
14+
15+
> `readonly` `optional` **dashboardName**: `string`
16+
17+
Optional A name for the dashboard which will be created.
18+
If existingDashboard is defined, this value will be ignored.
19+
If not provided, the construct will create a new dashboard named 'BedrockMetricsDashboard'
20+
21+
#### Default
22+
23+
```ts
24+
- none
25+
```
26+
27+
***
28+
29+
### existingDashboard?
30+
31+
> `readonly` `optional` **existingDashboard**: `Dashboard`
32+
33+
Optional An existing dashboard where metrics will be added to.
34+
If not provided, the construct will create a new dashboard
35+
36+
#### Default
37+
38+
```ts
39+
- none
40+
```
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[**@cdklabs/generative-ai-cdk-constructs**](../README.md)**Docs**
2+
3+
***
4+
5+
[@cdklabs/generative-ai-cdk-constructs](../README.md) / ModelMonitoringProps
6+
7+
# Interface: ModelMonitoringProps
8+
9+
The properties for the ModelMonitoringProps class.
10+
11+
## Properties
12+
13+
### period?
14+
15+
> `readonly` `optional` **period**: `Duration`

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,4 @@ export * from './common/props/DockerLambdaCustomProps';
2828
export * from './common/props/LangchainProps';
2929
export * from './common/base-class/base-class';
3030
export * from './common/base-class/construct-name-enum';
31+
export * from './patterns/gen-ai/aws-bedrock-cw-dashboard';

0 commit comments

Comments
 (0)