Skip to content

Commit 60972d3

Browse files
author
Yuriy Bezsonov
committed
add all stacks
1 parent c71d527 commit 60972d3

20 files changed

+5189
-642
lines changed

.kiro/specs/infra/design.md

Lines changed: 43 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ infra/
2929
│ │ └── WorkshopApp.java # Main CDK application
3030
│ ├── src/main/resources/
3131
│ │ ├── userdata.sh # Minimal UserData script (embedded in CDK)
32+
│ │ ├── iam-policy-base.json
33+
│ │ ├── iam-policy-java-on-aws-immersion-day.json
34+
│ │ ├── iam-policy-java-on-amazon-eks.json
35+
│ │ ├── iam-policy-java-ai-agents.json
36+
│ │ ├── iam-policy-java-spring-ai-agents.json
3237
│ │ └── lambda/ # Lambda function source files
3338
│ │ ├── ec2-launcher.py
3439
│ │ ├── codebuild-start.py
@@ -41,7 +46,10 @@ infra/
4146
│ └── cdk.json
4247
├── cfn/ # Generated CloudFormation templates
4348
│ ├── base-stack.yaml
44-
│ └── java-on-aws-stack.yaml
49+
│ ├── java-on-aws-immersion-day-stack.yaml
50+
│ ├── java-on-amazon-eks-stack.yaml
51+
│ ├── java-ai-agents-stack.yaml
52+
│ └── java-spring-ai-agents-stack.yaml
4553
├── scripts/
4654
│ ├── ide/ # IDE setup scripts
4755
│ │ ├── bootstrap.sh # Full bootstrap orchestration
@@ -53,7 +61,10 @@ infra/
5361
│ │ └── shell-p10k.zsh # Powerlevel10k configuration
5462
│ ├── templates/ # Workshop-specific post-deploy scripts
5563
│ │ ├── base.sh # Base template (empty placeholder)
56-
│ │ └── java-on-aws.sh # Java-on-AWS workshop setup
64+
│ │ ├── java-on-aws-immersion-day.sh # Java-on-AWS Immersion Day workshop setup
65+
│ │ ├── java-on-amazon-eks.sh # Java-on-Amazon-EKS workshop setup (same as java-on-aws-immersion-day)
66+
│ │ ├── java-ai-agents.sh # Java-AI-Agents workshop setup (same as base)
67+
│ │ └── java-spring-ai-agents.sh # Java-Spring-AI-Agents workshop setup (same as base)
5768
│ ├── setup/ # Infrastructure setup scripts
5869
│ │ ├── eks.sh # EKS cluster configuration
5970
│ │ ├── monitoring.sh # Prometheus + Grafana setup
@@ -81,28 +92,37 @@ public class WorkshopStack extends Stack {
8192
public WorkshopStack(final Construct scope, final String id, final StackProps props) {
8293
super(scope, id, props);
8394

84-
String templateType = System.getenv("TEMPLATE_TYPE");
95+
String templateType = (String) this.getNode().tryGetContext("template.type");
8596
if (templateType == null) {
8697
templateType = "base"; // default
8798
}
8899

89100
// Core infrastructure (always created)
90101
var vpc = new Vpc(this, "Vpc");
91-
var ide = new Ide(this, "Ide", vpc.getVpc());
102+
var ide = new Ide(this, "Ide", ideProps);
92103

93-
// Custom roles and database only for non-base templates
94-
if (!"base".equals(templateType)) {
95-
var roles = new Roles(this, "Roles");
104+
// java-on-aws-immersion-day and java-on-amazon-eks specific resources
105+
if ("java-on-aws-immersion-day".equals(templateType) || "java-on-amazon-eks".equals(templateType)) {
106+
new CodeBuild(this, "CodeBuild", codeBuildProps);
96107
var database = new Database(this, "Database", vpc.getVpc());
108+
var eks = new Eks(this, "Eks", eksProps);
109+
var performanceAnalysis = new PerformanceAnalysis(this, "PerformanceAnalysis", analysisProps);
110+
var unicorn = new Unicorn(this, "Unicorn", unicornProps);
97111
}
98-
99-
// CodeBuild for service-linked role creation
100-
new CodeBuild(this, "CodeBuild",
101-
Map.of("STACK_NAME", Aws.STACK_NAME, "TEMPLATE_TYPE", templateType));
102112
}
103113
}
104114
```
105115

116+
#### Supported Template Types
117+
118+
| Template Type | Resources Created |
119+
|---------------|-------------------|
120+
| `base` | VPC, IDE |
121+
| `java-ai-agents` | VPC, IDE (same as base) |
122+
| `java-spring-ai-agents` | VPC, IDE (same as base) |
123+
| `java-on-aws-immersion-day` | VPC, IDE, CodeBuild, Database, EKS, PerformanceAnalysis, Unicorn |
124+
| `java-on-amazon-eks` | VPC, IDE, CodeBuild, Database, EKS, PerformanceAnalysis, Unicorn (same as java-on-aws-immersion-day) |
125+
106126
#### Reusable Constructs
107127

108128
**Vpc**: Creates VPC with appropriate subnets and networking configuration
@@ -195,7 +215,12 @@ infra/cdk/src/main/resources/
195215
│ ├── cloudfront-prefix-lookup.py # CloudFront prefix list lookup
196216
│ └── thread-dump-lambda.py # Thread dump collection and AI analysis
197217
├── userdata.sh # Minimal UserData script with CloudWatch logging
198-
├── iam-policy.json # IAM policy for workshop participants
218+
├── iam-policy-base.json # Base template IAM policy (Allow *)
219+
├── iam-policy-java-on-aws-immersion-day.json # Java-on-AWS Immersion Day workshop IAM policy
220+
├── iam-policy-java-on-amazon-eks.json # Java-on-Amazon-EKS workshop IAM policy (same as java-on-aws-immersion-day)
221+
├── iam-policy-java-ai-agents.json # Java-AI-Agents workshop IAM policy (same as base)
222+
├── iam-policy-java-spring-ai-agents.json # Java-Spring-AI-Agents workshop IAM policy (same as base)
223+
├── iam-policy-{workshop}.json # Workshop-specific IAM policies (required for each template type)
199224
└── unicorns.sql # Database schema SQL
200225
```
201226

@@ -277,8 +302,11 @@ infra/scripts/ide/
277302
└── shell-p10k.zsh # Powerlevel10k configuration
278303
279304
infra/scripts/templates/
280-
├── base.sh # Base template (empty placeholder)
281-
└── java-on-aws.sh # Java-on-AWS workshop post-deploy
305+
├── base.sh # Base template (empty placeholder)
306+
├── java-on-aws-immersion-day.sh # Java-on-AWS Immersion Day workshop post-deploy
307+
├── java-on-amazon-eks.sh # Java-on-Amazon-EKS workshop post-deploy (same as java-on-aws-immersion-day)
308+
├── java-ai-agents.sh # Java-AI-Agents workshop post-deploy (same as base)
309+
└── java-spring-ai-agents.sh # Java-Spring-AI-Agents workshop post-deploy (same as base)
282310
```
283311

284312
#### Bootstrap Flow
@@ -398,7 +426,7 @@ echo "✅ Generated workshop-template.yaml"
398426
#!/bin/bash
399427
set -e
400428

401-
WORKSHOPS=("ide" "java-on-aws" "java-on-eks" "java-ai-agents" "java-spring-ai-agents")
429+
WORKSHOPS=("ide" "java-on-aws-immersion-day" "java-on-amazon-eks" "java-ai-agents" "java-spring-ai-agents")
402430

403431
for workshop in "${WORKSHOPS[@]}"; do
404432
target_dir="../$workshop/static"

.kiro/specs/infra/tasks.md

Lines changed: 52 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,20 @@
3333
- _Requirements: 4.1, 4.4_
3434

3535
- [x] 2.2 Create workshop sync script
36-
- Create infra/scripts/cfn/sync.sh that copies workshop-template.yaml to workshop directories as {workshop}-stack.yaml
37-
- Include iam-policy.json copying from cdk/src/main/resources/ directory to workshop static/ directories
38-
- Implement directory existence checking and error reporting
39-
- Support workshop list: ide, java-on-aws, java-on-eks, java-ai-agents, java-spring-ai-agents
36+
- Create infra/scripts/cfn/sync.sh that copies cfn/{workshop}-stack.yaml → workshop-stack.yaml ✅
37+
- Copy workshop-specific IAM policies (iam-policy-{workshop}.json → iam-policy.json) ✅
38+
- Target files use static names: workshop-stack.yaml and iam-policy.json ✅
39+
- Implement directory existence checking and error reporting ✅
40+
- Support workshop list: ide, java-on-aws-immersion-day, java-on-amazon-eks, java-ai-agents, java-spring-ai-agents ✅
4041
- _Requirements: 4.2, 4.5_
4142

4243
- [x] 2.3 Set up build automation
43-
- Create infra/package.json with generate and sync npm scripts
44-
- Make scripts executable and test npm run generate && npm run sync workflow
45-
- Validate that generated templates are copied to correct locations with proper naming
46-
- Copy existing iam-policy.json to infra/cdk/src/main/resources/ for single source of truth
44+
- Create infra/package.json with generate and sync npm scripts ✅
45+
- Make scripts executable and test npm run generate && npm run sync workflow ✅
46+
- Validate that generated templates are copied to correct locations with proper naming ✅
47+
- Workshop-specific IAM policies stored as iam-policy-{workshop}.json in cdk/src/main/resources/ ✅
48+
- Ide.java loads iam-policy-{templateType}.json and throws exception if not found ✅
49+
- Created iam-policy-base.json with Allow * for base template ✅
4750
- _Requirements: 4.3_
4851

4952
## Base IDE Stack (10.x)
@@ -383,9 +386,9 @@
383386
- Enabled easy filtering and management of workshop resources in AWS console and CLI
384387
- _Requirements: 21.1, 21.2, 21.3, 21.4, 21.5_
385388

386-
## Java-on-AWS Migration (100.x)
389+
## Java-on-AWS-Immersion-Day Migration (100.x)
387390

388-
- [x] 100.1 Analyze java-on-aws workshop requirements
391+
- [x] 100.1 Analyze java-on-aws-immersion-day workshop requirements
389392
- Reviewed infrastructure/cfn/unicornstore-stack.yaml and identified required resources ✅
390393
- Documented EKS, Database, and other workshop-specific components ✅
391394
- Mapped existing resources to new construct pattern ✅
@@ -416,14 +419,14 @@
416419
- Consolidate RDS and database schema setup into single construct
417420
- _Requirements: 5.6, 12.1, 12.2, 12.3, 12.4, 12.5, 12.6_
418421

419-
- [x] 100.4 Update WorkshopStack for java-on-aws with EKS integration
422+
- [x] 100.4 Update WorkshopStack for java-on-aws-immersion-day with EKS integration
420423
- Database already conditionally created for non-base templates (same as Roles) ✅
421424
- Added conditional EKS creation: if (!"base".equals(templateType) && !"java-ai-agents".equals(templateType)) ✅
422425
- Integrated EKS with IDE security group: eks.ideInternalSecurityGroup(ide.getIdeInternalSecurityGroup()) ✅
423426
- Integrated EKS with IDE instance role: eks.ideInstanceRole(ideProps.getIdeRole()) ✅
424-
- Tested TEMPLATE_TYPE=java-on-aws generates template with VPC, IDE, CodeBuild, Roles, Database, and EKS resources ✅
427+
- Tested TEMPLATE_TYPE=java-on-aws-immersion-day generates template with VPC, IDE, CodeBuild, Roles, Database, and EKS resources ✅
425428
- Validated generated template includes all EKS add-ons and Access Entries configuration ✅
426-
- Ensured template supports both java-on-aws and base templates from same codebase ✅
429+
- Ensured template supports both java-on-aws-immersion-day and base templates from same codebase ✅
427430
- _Requirements: 1.2, 1.3, 13.1, 16.1_
428431

429432
- [x] 100.5 Create EKS post-deployment setup script
@@ -439,8 +442,8 @@
439442
- Verified all three add-ons are installed and functional before completing ✅
440443
- _Requirements: 15.1, 15.2, 14.2, 14.3, 14.4, 15.7, 18.1, 18.2, 18.3, 18.4, 18.6_
441444

442-
- [x] 100.6 Create java-on-aws workshop orchestration script
443-
- Created infra/scripts/ide/java-on-aws.sh that executes base.sh and workshop-specific setup ✅
445+
- [x] 100.6 Create java-on-aws-immersion-day workshop orchestration script
446+
- Created infra/scripts/templates/java-on-aws-immersion-day.sh that executes base.sh and workshop-specific setup ✅
444447
- Script calls base.sh first for foundational development tools ✅
445448
- Then executes EKS-specific setup (cluster configuration, add-ons, storage classes) ✅
446449
- Added Phase 3: Monitoring stack (Prometheus + Grafana) via monitoring.sh ✅
@@ -480,8 +483,8 @@
480483
- Updated bootstrap.sh to call tools.sh as part of default IDE setup (after vscode/code-editor) ✅
481484
- Created templates/ directory for workshop-specific post-deploy scripts ✅
482485
- Created templates/base.sh as empty placeholder with comment ✅
483-
- Moved java-on-aws.sh to templates/java-on-aws.sh ✅
484-
- Updated java-on-aws.sh to NOT call base (tools already installed by bootstrap) ✅
486+
- Moved java-on-aws-immersion-day.sh to templates/java-on-aws-immersion-day.sh ✅
487+
- Updated java-on-aws-immersion-day.sh to NOT call base (tools already installed by bootstrap) ✅
485488
- Updated bootstrap.sh to look for template scripts in templates/ folder ✅
486489
- Updated vscode.sh and code-editor.sh to use settings.sh ✅
487490
- Final structure:
@@ -504,14 +507,14 @@
504507
- eks.sh: "✅ Success: EKS cluster (workshop-eks)" ✅
505508
- monitoring.sh: "✅ Success: Monitoring (Prometheus + Grafana)" ✅
506509
- analysis.sh: "✅ Success: Analysis (Thread + Profiling dashboards)" ✅
507-
- java-on-aws.sh: "✅ Success: Java-on-AWS workshop template" ✅
510+
- java-on-aws-immersion-day.sh: "✅ Success: Java-on-AWS-Immersion-Day workshop template" ✅
508511
- _Requirements: 3.3, 3.7, 6.6_
509512

510513

511514

512-
- [x] 100.11 Validate java-on-aws migration
513-
- Generated template with TEMPLATE_TYPE=java-on-aws and verified all EKS resources are present ✅
514-
- Tested template generation for both base and java-on-aws from same codebase ✅
515+
- [x] 100.11 Validate java-on-aws-immersion-day migration
516+
- Generated template with TEMPLATE_TYPE=java-on-aws-immersion-day and verified all EKS resources are present ✅
517+
- Tested template generation for both base and java-on-aws-immersion-day from same codebase ✅
515518
- Verified EKS add-ons, Access Entries, and database resources are properly configured ✅
516519
- Documented template differences and ensured they provide equivalent functionality ✅
517520
- _Requirements: 1.2, 1.3, 16.1_
@@ -542,11 +545,11 @@
542545
- _Requirements: 5.6_
543546

544547
- [x] 100.15 Integrate PerformanceAnalysis into WorkshopStack
545-
- Added conditional PerformanceAnalysis creation for java-on-aws template type ✅
548+
- Added conditional PerformanceAnalysis creation for java-on-aws-immersion-day template type ✅
546549
- Passed EKS cluster reference for Access Entry creation ✅
547550
- Passed VPC reference for Lambda VPC placement ✅
548551
- Tested template generation with PerformanceAnalysis resources ✅
549-
- Verified all resources present in generated java-on-aws-stack.yaml ✅
552+
- Verified all resources present in generated java-on-aws-immersion-day-stack.yaml ✅
550553
- _Requirements: 1.2, 1.3_
551554

552555
- [x] 100.16 Create thread-dump-lambda.py implementation
@@ -570,22 +573,33 @@
570573
- Note: ESO roles not needed - replaced by AWS Secrets Store CSI Driver add-on
571574
- _Requirements: 5.6_
572575

573-
## Java-AI-Agents Migration (300.x)
576+
## Java-on-Amazon-EKS Template (200.x)
574577

575-
- [ ] 300.1 Analyze and migrate java-ai-agents workshop
576-
- Review infrastructure/cfn/java-ai-agents-stack.yaml (no EKS, includes Bedrock permissions, has database)
577-
- Verify EKS exclusion logic: if (!"base".equals(workshopType) && !"java-ai-agents".equals(workshopType))
578-
- Database will be included automatically (non-base template)
579-
- Create infra/scripts/setup/ai-agents.sh for AI-specific setup
580-
- Create infra/scripts/workshops/java-ai-agents.sh orchestration script
581-
- _Requirements: 5.4, 5.5_
578+
- [x] 200.1 Create java-on-amazon-eks template (same infrastructure as java-on-aws-immersion-day)
579+
- Updated WorkshopStack.java to include java-on-amazon-eks in same conditional as java-on-aws-immersion-day ✅
580+
- Updated generate.sh to generate java-on-amazon-eks-stack.yaml template ✅
581+
- Created infra/scripts/templates/java-on-amazon-eks.sh (same setup as java-on-aws-immersion-day.sh) ✅
582+
- Created infra/cdk/src/main/resources/iam-policy-java-on-amazon-eks.json (copy of java-on-aws-immersion-day policy) ✅
583+
- Template includes: VPC, IDE, CodeBuild, Database, EKS, PerformanceAnalysis, Unicorn ✅
584+
- _Requirements: 1.2, 1.3, 5.4_
582585

583-
## Java-Spring-AI-Agents Migration (400.x)
586+
## Java-AI-Agents Migration (300.x)
584587

585-
- [ ] 400.1 Analyze and migrate java-spring-ai-agents workshop
586-
- Review infrastructure/cfn/spring-ai-stack.yaml for specific requirements
587-
- Create infra/scripts/setup/spring-ai.sh for Spring AI specific setup
588-
- Create infra/scripts/workshops/java-spring-ai-agents.sh orchestration script
589-
- Validate template generation and workshop setup scripts
590-
- _Requirements: 5.4, 5.5_
588+
- [x] 300.1 Create java-ai-agents template (same infrastructure as base)
589+
- Updated generate.sh to generate java-ai-agents-stack.yaml template ✅
590+
- Created infra/scripts/templates/java-ai-agents.sh (minimal setup, no EKS/Database) ✅
591+
- Created infra/cdk/src/main/resources/iam-policy-java-ai-agents.json (Allow * like base) ✅
592+
- Template includes: VPC, IDE, CodeBuild only (same as base) ✅
593+
- No EKS, Database, PerformanceAnalysis, or Unicorn resources ✅
594+
- _Requirements: 1.2, 1.3, 5.4_
595+
596+
## Java-Spring-AI-Agents Template (400.x)
597+
598+
- [x] 400.1 Create java-spring-ai-agents template (same infrastructure as base)
599+
- Updated generate.sh to generate java-spring-ai-agents-stack.yaml template ✅
600+
- Created infra/scripts/templates/java-spring-ai-agents.sh (minimal setup, no EKS/Database) ✅
601+
- Created infra/cdk/src/main/resources/iam-policy-java-spring-ai-agents.json (Allow * like base) ✅
602+
- Template includes: VPC, IDE only (same as base) ✅
603+
- No EKS, Database, PerformanceAnalysis, or Unicorn resources ✅
604+
- _Requirements: 1.2, 1.3, 5.4_
591605

infra/cdk/src/main/java/sample/com/WorkshopStack.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ public class WorkshopStack extends Stack {
2626
- |
2727
# Resolution for when creating the first service in the account
2828
aws iam create-service-linked-role --aws-service-name ecs.amazonaws.com 2>/dev/null || true
29-
aws iam create-service-linked-role --aws-service-name apprunner.amazonaws.com 2>/dev/null || true
3029
aws iam create-service-linked-role --aws-service-name elasticloadbalancing.amazonaws.com 2>/dev/null || true
3130
""";
3231

@@ -56,19 +55,20 @@ public WorkshopStack(final Construct scope, final String id, final StackProps pr
5655
.build();
5756
Ide ide = new Ide(this, "Ide", ideProps);
5857

59-
// CodeBuild for workshop setup
60-
CodeBuild codeBuild = new CodeBuild(this, "CodeBuild",
61-
CodeBuild.CodeBuildProps.builder()
62-
.projectName("workshop-setup")
63-
.vpc(vpc.getVpc())
64-
.environmentVariables(Map.of(
65-
"TEMPLATE_TYPE", templateType,
66-
"GIT_BRANCH", gitBranch))
67-
.buildSpec(buildSpec)
68-
.build());
58+
// java-on-aws-immersion-day and java-on-amazon-eks specific resources (CodeBuild for service-linked roles)
59+
if ("java-on-aws-immersion-day".equals(templateType) || "java-on-amazon-eks".equals(templateType)) {
60+
// CodeBuild for workshop setup (service-linked role creation)
61+
new CodeBuild(this, "CodeBuild",
62+
CodeBuild.CodeBuildProps.builder()
63+
.projectName("workshop-setup")
64+
.vpc(vpc.getVpc())
65+
.environmentVariables(Map.of(
66+
"TEMPLATE_TYPE", templateType,
67+
"GIT_BRANCH", gitBranch))
68+
.buildSpec(buildSpec)
69+
.build());
6970

70-
// java-on-aws specific resources
71-
if ("java-on-aws".equals(templateType)) {
71+
// Database, EKS, PerformanceAnalysis, Unicorn
7272
Database database = new Database(this, "Database", vpc.getVpc());
7373

7474
// EKS cluster

0 commit comments

Comments
 (0)