Skip to content

Commit d0876c0

Browse files
author
Yuriy Bezsonov
committed
WIP
1 parent 7340114 commit d0876c0

File tree

10 files changed

+124
-75
lines changed

10 files changed

+124
-75
lines changed

.kiro/specs/infra/design.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,32 @@ All CDK constructs follow a consistent naming pattern to ensure clean CloudForma
102102

103103
This convention eliminates CloudFormation logical ID duplication and ensures maintainable resource naming.
104104

105+
#### AWS Resource Naming Convention
106+
107+
All AWS resources follow a consistent "workshop-" prefix pattern for operational clarity:
108+
109+
**Lambda Functions:**
110+
- `workshop-codebuild-start` - CodeBuild start trigger
111+
- `workshop-codebuild-report` - CodeBuild completion handler
112+
- `workshop-ide-prefixlist` - CloudFront prefix list lookup
113+
- `workshop-ide-launcher` - EC2 instance launcher with failover
114+
- `workshop-ide-password` - Password retrieval from Secrets Manager
115+
- `workshop-database-setup` - Database schema initialization
116+
117+
**CodeBuild Projects:**
118+
- `workshop-setup` - Workshop environment setup and service-linked role creation
119+
120+
**CloudWatch Log Groups:**
121+
- `workshop-ide-bootstrap-{timestamp}` - IDE bootstrap logs with unique timestamps
122+
- `/aws/lambda/workshop-*` - All Lambda function logs grouped by prefix
123+
- `/aws/codebuild/workshop-setup` - CodeBuild execution logs
124+
125+
This naming convention enables:
126+
- **Easy filtering** in AWS Console and CLI using `workshop-*` patterns
127+
- **Operational management** through consistent resource identification
128+
- **Cost tracking** and monitoring of workshop-related resources
129+
- **Automated cleanup** and maintenance scripts
130+
105131
### Lambda Function Architecture
106132

107133
#### Design Rationale

.kiro/specs/infra/requirements.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ This document specifies the requirements for creating a new AWS workshop infrast
2424
- **Modular_Scripts**: Architecture where bootstrap functionality is separated into focused scripts (UserData → bootstrap → vscode → base)
2525
- **CDK_Naming_Convention**: Consistent pattern for CDK construct resource naming that produces clean CloudFormation logical IDs following {ConstructName}{ResourceType} format
2626
- **EKS_IDE_Integration**: Architecture pattern where EKS cluster shares security groups and IAM roles with IDE environment for seamless kubectl access
27+
- **Workshop_Naming_Convention**: Consistent resource naming pattern using "workshop-" prefix followed by component and function names for operational clarity and management
2728

2829
## Requirements
2930

@@ -282,3 +283,15 @@ This document specifies the requirements for creating a new AWS workshop infrast
282283
4. WHEN EKS cluster integrates with IDE, THE system SHALL share security groups and IAM roles through proper construct interfaces
283284
5. WHEN construct naming is applied consistently, THE system SHALL ensure all resources follow the same naming convention across VPC, IDE, Database, EKS, and CodeBuild constructs
284285

286+
### Requirement 21
287+
288+
**User Story:** As a workshop developer, I want consistent logging and resource naming with a universal "workshop-" prefix, so that all workshop-related resources are easily identifiable, filterable, and manageable in AWS services.
289+
290+
#### Acceptance Criteria
291+
292+
1. WHEN Lambda functions are created, THE system SHALL use "workshop-" prefix followed by component and function name (e.g., "workshop-ide-launcher", "workshop-database-setup")
293+
2. WHEN CodeBuild projects are created, THE system SHALL use "workshop-" prefix for project names (e.g., "workshop-setup")
294+
3. WHEN CloudWatch log groups are created, THE system SHALL use "workshop-" prefix for consistent grouping and filtering
295+
4. WHEN bootstrap logging is configured, THE system SHALL use "workshop-ide-bootstrap-{timestamp}" pattern for unique log group names
296+
5. WHEN AWS resources are named, THE system SHALL follow the pattern "workshop-{component}-{function}" for operational consistency
297+

.kiro/specs/infra/tasks.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,16 @@
373373
- Applied consistent naming convention: construct name + resource type (e.g., Ide + PasswordSecret = IdePasswordSecret)
374374
- _Requirements: 1.1, 5.6_
375375

376+
- [x] 11.28 Implement consistent "workshop-" naming convention for all AWS resources
377+
- Updated Lambda function names to use "workshop-" prefix: "setup-codebuild-start" → "workshop-codebuild-start", "ide-ec2-launcher" → "workshop-ide-launcher"
378+
- Updated CodeBuild project name: "workshop-codebuild" → "workshop-setup" for consistency
379+
- Updated Database Lambda: "workshop-db-setup" → "workshop-database-setup" for clarity
380+
- Updated IDE Lambda functions: "ide-cloudfront-prefix-lookup" → "workshop-ide-prefixlist", dynamic password function → "workshop-ide-password"
381+
- Updated bootstrap log group: "ide-bootstrap-{timestamp}" → "workshop-ide-bootstrap-{timestamp}" for consistent grouping
382+
- Applied universal "workshop-{component}-{function}" naming pattern across all AWS resources
383+
- Enabled easy filtering and management of workshop resources in AWS console and CLI
384+
- _Requirements: 21.1, 21.2, 21.3, 21.4, 21.5_
385+
376386
## Java-on-AWS Migration (100.x)
377387

378388
- [x] 100.1 Analyze java-on-aws workshop requirements

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public WorkshopStack(final Construct scope, final String id, final StackProps pr
5959
// CodeBuild for workshop setup
6060
CodeBuild codeBuild = new CodeBuild(this, "CodeBuild",
6161
CodeBuild.CodeBuildProps.builder()
62-
.projectName("workshop-codebuild")
62+
.projectName("workshop-setup")
6363
.vpc(vpc.getVpc())
6464
.environmentVariables(Map.of(
6565
"TEMPLATE_TYPE", templateType,

infra/cdk/src/main/java/sample/com/constructs/CodeBuild.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,12 @@ public CodeBuild(final Construct scope, final String id, final CodeBuildProps pr
131131

132132
// Create start build Lambda function
133133
var startLambda = new Lambda(this, "StartLambda",
134-
"/lambda/codebuild-start.py", "setup-codebuild-start", Duration.minutes(2), lambdaRole);
134+
"/lambda/codebuild-start.py", "workshop-codebuild-start", Duration.minutes(2), lambdaRole);
135135
Function startBuildFunction = startLambda.getFunction();
136136

137137
// Create report build Lambda function
138138
var reportLambda = new Lambda(this, "ReportLambda",
139-
"/lambda/codebuild-report.py", "setup-codebuild-report", Duration.minutes(2), lambdaRole);
139+
"/lambda/codebuild-report.py", "workshop-codebuild-report", Duration.minutes(2), lambdaRole);
140140
Function reportBuildFunction = reportLambda.getFunction();
141141

142142
// Create EventBridge rule for build completion

infra/cdk/src/main/java/sample/com/constructs/Database.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public Database(final Construct scope, final String id, final IVpc vpc) {
114114
.code(Code.fromInline(loadFile("/lambda/database-setup.py")))
115115
.handler("index.lambda_handler")
116116
.runtime(Runtime.PYTHON_3_13)
117-
.functionName("workshop-db-setup")
117+
.functionName("workshop-database-setup")
118118
.timeout(Duration.minutes(3))
119119
.vpc(vpc)
120120
.securityGroups(List.of(databaseSecurityGroup))

infra/cdk/src/main/java/sample/com/constructs/Ide.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ public Ide(final Construct scope, final String id, final IdeProps props) {
170170

171171
// Create CloudFront prefix list lookup Lambda function
172172
var prefixListLookup = new Lambda(this, "PrefixListLookup",
173-
"/lambda/cloudfront-prefix-lookup.py", "ide-cloudfront-prefix-lookup", Duration.minutes(3), lambdaRole);
173+
"/lambda/cloudfront-prefix-lookup.py", "workshop-ide-prefixlist", Duration.minutes(3), lambdaRole);
174174
var prefixListFunction = prefixListLookup.getFunction();
175175

176176
// Add EC2 permissions for prefix list lookup
@@ -269,7 +269,7 @@ public Ide(final Construct scope, final String id, final IdeProps props) {
269269

270270
// Create instance launcher Lambda with multi-AZ and multi-instance-type failover
271271
var instanceLauncher = new Lambda(this, "InstanceLauncher",
272-
"/lambda/ec2-launcher.py", "ide-ec2-launcher", Duration.minutes(5), lambdaRole);
272+
"/lambda/ec2-launcher.py", "workshop-ide-launcher", Duration.minutes(5), lambdaRole);
273273
var instanceLauncherFunction = instanceLauncher.getFunction();
274274

275275
// Create EC2 instance via Custom Resource with intelligent failover
@@ -378,7 +378,7 @@ private String getIdePassword(String instanceName) {
378378
.handler("index.lambda_handler")
379379
.runtime(Runtime.PYTHON_3_13)
380380
.timeout(Duration.minutes(3))
381-
.functionName(instanceName + "-password-exporter")
381+
.functionName("workshop-ide-password")
382382
.build();
383383

384384
ideSecretsManagerPassword.grantRead(passwordFunction);

infra/cdk/src/main/resources/userdata.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export TEMPLATE_TYPE="${TEMPLATE_TYPE}"
1111
export WAIT_CONDITION_HANDLE_URL="${WAIT_CONDITION_HANDLE_URL}"
1212

1313
# Setup logging
14-
LOG_GROUP_NAME="ide-bootstrap-$(date +%Y%m%d-%H%M%S)"
14+
LOG_GROUP_NAME="workshop-ide-bootstrap-$(date +%Y%m%d-%H%M%S)"
1515
echo "Bootstrap logs will be written to CloudWatch log group: $LOG_GROUP_NAME"
1616

1717
# Install CloudWatch agent for logging

infra/cfn/base-stack.yaml

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ Resources:
459459
responseData = {'Error': tb_err}
460460
finally:
461461
cfnresponse.send(event, context, status, responseData, 'CustomResourcePhysicalID')
462-
FunctionName: ide-cloudfront-prefix-lookup
462+
FunctionName: workshop-ide-prefixlist
463463
Handler: index.lambda_handler
464464
Role:
465465
Fn::GetAtt:
@@ -696,7 +696,7 @@ Resources:
696696
responseData = {'Error': tb_err}
697697
698698
cfnresponse.send(event, context, status, responseData, physical_id)
699-
FunctionName: ide-ec2-launcher
699+
FunctionName: workshop-ide-launcher
700700
Handler: index.lambda_handler
701701
Role:
702702
Fn::GetAtt:
@@ -714,30 +714,19 @@ Resources:
714714
Fn::GetAtt:
715715
- IdeInstanceLauncherFunction803C5A2A
716716
- Arn
717-
InstanceName: ide
718-
IamInstanceProfileArn:
719-
Fn::GetAtt:
720-
- IdeInstanceProfile61B92038
721-
- Arn
722-
VolumeSize: "50"
723717
SubnetIds:
724718
Fn::Join:
725719
- ""
726720
- - Ref: VpcPublicSubnet1Subnet8E8DEDC0
727721
- ","
728722
- Ref: VpcPublicSubnet2SubnetA811849C
729-
SecurityGroupIds:
730-
Fn::Join:
731-
- ""
732-
- - Fn::GetAtt:
733-
- IdeSecurityGroup73B02454
734-
- GroupId
735-
- ","
736-
- Fn::GetAtt:
737-
- IdeInternalSecurityGroupB0A5D76B
738-
- GroupId
739-
ImageId:
740-
Ref: SsmParameterValueawsserviceamiamazonlinuxlatestal2023amikernel61x8664C96584B6F00A464EAD1953AFF4B05118Parameter
723+
VolumeSize: "50"
724+
IamInstanceProfileArn:
725+
Fn::GetAtt:
726+
- IdeInstanceProfile61B92038
727+
- Arn
728+
InstanceName: ide
729+
InstanceTypes: m5.xlarge,m6i.xlarge,t3.xlarge
741730
UserData:
742731
Fn::Base64:
743732
Fn::Join:
@@ -763,7 +752,7 @@ Resources:
763752
"
764753
765754
# Setup logging
766-
LOG_GROUP_NAME="ide-bootstrap-$(date +%Y%m%d-%H%M%S)"
755+
LOG_GROUP_NAME="workshop-ide-bootstrap-$(date +%Y%m%d-%H%M%S)"
767756
echo "Bootstrap logs will be written to CloudWatch log group: $LOG_GROUP_NAME"
768757
769758
# Install CloudWatch agent for logging
@@ -871,7 +860,18 @@ Resources:
871860
"
872861
exit 1
873862
fi
874-
InstanceTypes: m5.xlarge,m6i.xlarge,t3.xlarge
863+
ImageId:
864+
Ref: SsmParameterValueawsserviceamiamazonlinuxlatestal2023amikernel61x8664C96584B6F00A464EAD1953AFF4B05118Parameter
865+
SecurityGroupIds:
866+
Fn::Join:
867+
- ""
868+
- - Fn::GetAtt:
869+
- IdeSecurityGroup73B02454
870+
- GroupId
871+
- ","
872+
- Fn::GetAtt:
873+
- IdeInternalSecurityGroupB0A5D76B
874+
- GroupId
875875
UpdateReplacePolicy: Delete
876876
DeletionPolicy: Delete
877877
IdeEipAssociationDFF81215:
@@ -1042,7 +1042,7 @@ Resources:
10421042
responseData = {'Error': tb_err}
10431043
10441044
cfnresponse.send(event, context, status, responseData, physical_id)
1045-
FunctionName: ide-password-exporter
1045+
FunctionName: workshop-ide-password
10461046
Handler: index.lambda_handler
10471047
Role:
10481048
Fn::GetAtt:
@@ -1251,7 +1251,7 @@ Resources:
12511251
ImagePullCredentialsType: CODEBUILD
12521252
PrivilegedMode: false
12531253
Type: LINUX_CONTAINER
1254-
Name: workshop-codebuild
1254+
Name: workshop-setup
12551255
ServiceRole:
12561256
Fn::GetAtt:
12571257
- CodeBuildRoleE9A44575
@@ -1369,7 +1369,7 @@ Resources:
13691369
responseData = {'Error': tb_err}
13701370
13711371
cfnresponse.send(event, context, status, responseData, physical_id)
1372-
FunctionName: setup-codebuild-start
1372+
FunctionName: workshop-codebuild-start
13731373
Handler: index.lambda_handler
13741374
Role:
13751375
Fn::GetAtt:
@@ -1435,7 +1435,7 @@ Resources:
14351435
'error': str(e)
14361436
})
14371437
}
1438-
FunctionName: setup-codebuild-report
1438+
FunctionName: workshop-codebuild-report
14391439
Handler: index.lambda_handler
14401440
Role:
14411441
Fn::GetAtt:
@@ -1449,7 +1449,7 @@ Resources:
14491449
CodeBuildCompleteRuleEE9277E8:
14501450
Type: AWS::Events::Rule
14511451
Properties:
1452-
Description: workshop-codebuild build complete
1452+
Description: workshop-setup build complete
14531453
EventPattern:
14541454
detail:
14551455
project-name:
@@ -1491,11 +1491,11 @@ Resources:
14911491
- Arn
14921492
ProjectName:
14931493
Ref: CodeBuildProjectA0FF5539
1494+
ContentHash: "1765725419413"
14941495
CodeBuildIamRoleArn:
14951496
Fn::GetAtt:
14961497
- CodeBuildRoleE9A44575
14971498
- Arn
1498-
ContentHash: "1765724681159"
14991499
DependsOn:
15001500
- CodeBuildCompleteRuleAllowEventRuleWorkshopStackCodeBuildReportLambdaFunctionD77C60919E0B0C89
15011501
- CodeBuildCompleteRuleEE9277E8

0 commit comments

Comments
 (0)