Skip to content

Commit df248bb

Browse files
committed
Updates to steering
1 parent e73d687 commit df248bb

File tree

7 files changed

+1388
-54
lines changed

7 files changed

+1388
-54
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,4 @@ kotlin/services/**/gradlew
3838
kotlin/services/**/gradlew.bat
3939
kotlin/services/**/.kotlin/
4040
/.local/
41+
/.kiro/settings

.kiro/settings/mcp.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"mcpServers": {
3+
"awslabs.bedrock-kb-retrieval-mcp-server": {
4+
"command": "uv",
5+
"args": [
6+
"tool",
7+
"run",
8+
"--from",
9+
"awslabs.bedrock-kb-retrieval-mcp-server@latest",
10+
"awslabs.bedrock-kb-retrieval-mcp-server.exe"
11+
],
12+
"env": {
13+
"FASTMCP_LOG_LEVEL": "ERROR",
14+
"AWS_PROFILE": "cex-ai-kb-access",
15+
"AWS_REGION": "us-west-2"
16+
},
17+
"disabled": false,
18+
"autoApprove": [
19+
"QueryKnowledgeBases"
20+
],
21+
"disabledTools": [
22+
"ListKnowledgeBases"
23+
]
24+
},
25+
"aws-knowledge-mcp-server": {
26+
"command": "uvx",
27+
"args": [
28+
"mcp-proxy",
29+
"--transport",
30+
"streamablehttp",
31+
"https://knowledge-mcp.global.api.aws"
32+
],
33+
"disabled": false,
34+
"autoApprove": [
35+
"aws___search_documentation",
36+
"aws___read_documentation"
37+
]
38+
}
39+
}
40+
}

.kiro/steering/orchestration.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Code Generation Orchestration
2+
3+
## Purpose
4+
Define location of relevant steering docs that are outside of the .kiro directory. Refer to all steering docs in the ./steering_docs directory. Use the appropriate steering instructions for the requested language. Use the directories given below.
5+
6+
- .NET: dotnet-tech
7+
- Java: java-tech
8+
- Kotlin: kotlin-tech
9+
10+
## Code Generation
11+
When a specification file is provided by the user, use that specification directly. Do not create your own spec or task breakdown. Follow the provided specification exactly and implement the requirements as described.
12+
13+
If no specification is provided, then do not use separate steps for planning and tasks unless specifically asked to do so. Perform the tasks without stopping for user input.
14+
15+
16+
17+

dotnetv4/DotNetV4Examples.sln

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,14 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CloudWatchScenario", "Cloud
9393
EndProject
9494
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CloudWatchActions", "CloudWatch\Actions\CloudWatchActions.csproj", "{EAF4A3B8-5CD0-48ED-B848-0EA6D451B8D3}"
9595
EndProject
96+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CloudWatchLogs", "CloudWatchLogs", "{A1B2C3D4-E5F6-7890-1234-567890ABCDEF}"
97+
EndProject
98+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CloudWatchLogsTests", "CloudWatchLogs\Tests\CloudWatchLogsTests.csproj", "{B2C3D4E5-F6A7-8901-2345-678901BCDEFG}"
99+
EndProject
100+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CloudWatchLogsScenarios", "CloudWatchLogs\Scenarios\CloudWatchLogsScenarios.csproj", "{C3D4E5F6-A7B8-9012-3456-789012CDEFGH}"
101+
EndProject
102+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CloudWatchLogsActions", "CloudWatchLogs\Actions\CloudWatchLogsActions.csproj", "{D4E5F6A7-B8C9-0123-4567-890123DEFGHI}"
103+
EndProject
96104
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "EC2", "EC2", "{9424FB14-B6DE-44CE-B675-AC2B57EC1E69}"
97105
EndProject
98106
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EC2Tests", "EC2\Tests\EC2Tests.csproj", "{C99A0F7C-9477-4985-90F6-8EED38ECAC10}"
@@ -279,6 +287,18 @@ Global
279287
{EAF4A3B8-5CD0-48ED-B848-0EA6D451B8D3}.Debug|Any CPU.Build.0 = Debug|Any CPU
280288
{EAF4A3B8-5CD0-48ED-B848-0EA6D451B8D3}.Release|Any CPU.ActiveCfg = Release|Any CPU
281289
{EAF4A3B8-5CD0-48ED-B848-0EA6D451B8D3}.Release|Any CPU.Build.0 = Release|Any CPU
290+
{B2C3D4E5-F6A7-8901-2345-678901BCDEFG}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
291+
{B2C3D4E5-F6A7-8901-2345-678901BCDEFG}.Debug|Any CPU.Build.0 = Debug|Any CPU
292+
{B2C3D4E5-F6A7-8901-2345-678901BCDEFG}.Release|Any CPU.ActiveCfg = Release|Any CPU
293+
{B2C3D4E5-F6A7-8901-2345-678901BCDEFG}.Release|Any CPU.Build.0 = Release|Any CPU
294+
{C3D4E5F6-A7B8-9012-3456-789012CDEFGH}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
295+
{C3D4E5F6-A7B8-9012-3456-789012CDEFGH}.Debug|Any CPU.Build.0 = Debug|Any CPU
296+
{C3D4E5F6-A7B8-9012-3456-789012CDEFGH}.Release|Any CPU.ActiveCfg = Release|Any CPU
297+
{C3D4E5F6-A7B8-9012-3456-789012CDEFGH}.Release|Any CPU.Build.0 = Release|Any CPU
298+
{D4E5F6A7-B8C9-0123-4567-890123DEFGHI}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
299+
{D4E5F6A7-B8C9-0123-4567-890123DEFGHI}.Debug|Any CPU.Build.0 = Debug|Any CPU
300+
{D4E5F6A7-B8C9-0123-4567-890123DEFGHI}.Release|Any CPU.ActiveCfg = Release|Any CPU
301+
{D4E5F6A7-B8C9-0123-4567-890123DEFGHI}.Release|Any CPU.Build.0 = Release|Any CPU
282302
{C99A0F7C-9477-4985-90F6-8EED38ECAC10}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
283303
{C99A0F7C-9477-4985-90F6-8EED38ECAC10}.Debug|Any CPU.Build.0 = Debug|Any CPU
284304
{C99A0F7C-9477-4985-90F6-8EED38ECAC10}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -392,6 +412,9 @@ Global
392412
{106FBE12-6FF7-40DC-9B3C-E5F67F335B32} = {CED87D19-7F82-4D67-8A30-3EE085D07E45}
393413
{565A9701-3D9C-49F8-86B7-D256A1D9E074} = {CED87D19-7F82-4D67-8A30-3EE085D07E45}
394414
{EAF4A3B8-5CD0-48ED-B848-0EA6D451B8D3} = {CED87D19-7F82-4D67-8A30-3EE085D07E45}
415+
{B2C3D4E5-F6A7-8901-2345-678901BCDEFG} = {A1B2C3D4-E5F6-7890-1234-567890ABCDEF}
416+
{C3D4E5F6-A7B8-9012-3456-789012CDEFGH} = {A1B2C3D4-E5F6-7890-1234-567890ABCDEF}
417+
{D4E5F6A7-B8C9-0123-4567-890123DEFGHI} = {A1B2C3D4-E5F6-7890-1234-567890ABCDEF}
395418
{C99A0F7C-9477-4985-90F6-8EED38ECAC10} = {9424FB14-B6DE-44CE-B675-AC2B57EC1E69}
396419
{6C167F25-F97F-4854-8CD8-A2D446B6799B} = {9424FB14-B6DE-44CE-B675-AC2B57EC1E69}
397420
{D95519CA-BD27-45AE-B83B-3FB02E7AE445} = {6C167F25-F97F-4854-8CD8-A2D446B6799B}
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
# CloudWatch Logs large query - Technical specification
2+
3+
This document contains the technical specifications for _CloudWatch Logs large query_,
4+
a feature scenario that showcases AWS services and SDKs. It is primarily intended for the AWS code
5+
examples team to use while developing this example in additional languages.
6+
7+
This document explains the following:
8+
9+
- Deploying AWS resources.
10+
- Adding sample data.
11+
- Setting up a large query.
12+
13+
For an introduction, see the [README.md](README.md).
14+
15+
---
16+
17+
### Table of contents
18+
19+
- [Architecture](#architecture)
20+
- [User input](#user-input)
21+
- [Common resources](#common-resources)
22+
- [Building the queries](#building-the-queries)
23+
- [Output](#output)
24+
- [Metadata](#metadata)
25+
26+
## Architecture
27+
28+
- Amazon CloudWatch Logs group
29+
- Amazon CloudWatch Logs stream
30+
31+
---
32+
33+
## User input
34+
35+
The example should allow the configuration of a query start date, query end date, and results limit. It's up to you to decide how to allow this configuration.
36+
37+
### Suggested variable names
38+
39+
- `QUERY_START_DATE` - The oldest date that will be queried.
40+
- `QUERY_END_DATE` - The newest date that will be queried.
41+
- `QUERY_LIMIT` - The maximum number of results to return. CloudWatch has a maximum of 10,000.
42+
43+
---
44+
45+
## Common resources
46+
47+
This example has a set of common resources that are stored in the [resources](resources) folder.
48+
49+
- [stack.yaml](resources/stack.yaml) is an AWS CloudFormation template containing the resources needed to run this example.
50+
- [make-log-files.sh](resources/make-log-files.sh) is a bash script that creates log data. **Five minutes of logs, starting at the time of execution, will be created. Wait at least five minutes after running this script before attempting to query.**
51+
- [put-log-events](resources/put-log-events.sh) is a bash script that ingests log data and uploads it to CloudWatch.
52+
53+
---
54+
55+
## Building the queries
56+
57+
### Building and waiting for single query
58+
59+
The query itself is a "CloudWatch Logs Insights query syntax" string. The query must return the `@timestamp` field so follow-up queries can use that information. Here's a sample query string: `fields @timestamp, @message | sort @timestamp asc`. Notice it sorts in ascending order. You can sort in either `asc` or `desc`, but the recursive strategy described later will need to match accordingly.
60+
61+
Queries are jobs. You can start a query with `StartQuery`, but it immediately returns the `queryId`. You must poll a query using `GetQueryResults` until the query has finished. For the purpose of this example, a query has "finished" when `GetQueryResults` has returned a status of one of "Complete", "Failed", "Cancelled", "Timeout", or "Unknown".
62+
63+
`StartQuery` responds with an error if the query's start or end date occurs out of bounds of the log group creation date. The error message starts with "Query's end date and time".
64+
65+
Start the query and wait for it to "finish". Store the `results`. If the count of the results is less than the configured LIMIT, return the results. If the results are greater than or equal to the limit, go to [Recursive queries](#recursive-queries).
66+
67+
---
68+
69+
### Recursive queries
70+
71+
If the result count from the previous step is 10000 (or the configured LIMIT), it is very likely that there are more results. **The example must do a binary search of the remaining logs**. To do this, get the date of the last log (earliest or latest, depending on sort order). Use that date as the start date of a new date range. The end date can remain the same.
72+
73+
Split that date range in half, resulting in two new date ranges. Call your query function twice; once for each new date range.
74+
75+
Concatenate the results of the first query with the results of the two new queries.
76+
77+
The following pseudocode illustrates this.
78+
79+
```pseudocode
80+
func large_query(date_range):
81+
query_results = get_query_results(date_range)
82+
83+
if query_results.length < LIMIT
84+
return query_results
85+
else
86+
date_range = [query_results.end, date_range.end]
87+
d1, d2 = split(date_range)
88+
return concat(query_results, large_query(d1), large_query(d2))
89+
```
90+
91+
## Output
92+
93+
To illustrate the search, log the date ranges for each query made and the number of logs that were found.
94+
95+
Example:
96+
97+
```
98+
Starting a recursive query...
99+
Query date range: 2023-12-22T19:08:42.000Z to 2023-12-22T19:13:41.994Z. Found 10000 logs.
100+
Query date range: 2023-12-22T19:09:41.995Z to 2023-12-22T19:11:41.994Z. Found 10000 logs.
101+
Query date range: 2023-12-22T19:11:41.995Z to 2023-12-22T19:13:41.994Z. Found 10000 logs.
102+
Query date range: 2023-12-22T19:10:41.995Z to 2023-12-22T19:11:11.994Z. Found 5000 logs.
103+
Query date range: 2023-12-22T19:11:11.995Z to 2023-12-22T19:11:41.994Z. Found 5000 logs.
104+
Query date range: 2023-12-22T19:12:41.995Z to 2023-12-22T19:13:11.994Z. Found 5000 logs.
105+
Query date range: 2023-12-22T19:13:11.995Z to 2023-12-22T19:13:41.994Z. Found 5000 logs.
106+
Queries finished in 11.253 seconds.
107+
Total logs found: 50000
108+
```
109+
110+
---
111+
112+
## Metadata
113+
114+
| action / scenario | metadata file | metadata key |
115+
| ----------------- | ----------------------------- | --------------------------------- |
116+
| `GetQueryResults` | cloudwatch-logs_metadata.yaml | cloudwatch-logs_GetQueryResults |
117+
| `StartQuery` | cloudwatch-logs_metadata.yaml | cloudwatch-logs_StartQuery |
118+
| `Large Query` | cloudwatch-logs_metadata.yaml | cloudwatch-logs_Scenario_LargeQuery |

0 commit comments

Comments
 (0)