Skip to content

Commit 5583222

Browse files
author
Yuriy Bezsonov
committed
WIP
1 parent 1bdc91b commit 5583222

File tree

5 files changed

+53
-78
lines changed

5 files changed

+53
-78
lines changed

.kiro/specs/infra/deployment-guide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ aws cloudformation deploy \
1313
--template-file cfn/java-on-aws-stack.yaml \
1414
--stack-name workshop-stack \
1515
--capabilities CAPABILITY_IAM CAPABILITY_NAMED_IAM \
16-
--s3-bucket workshop-cfn-templates-1765640257
16+
--s3-bucket workshop-cfn-templates-192330716364
1717
```
1818

1919
## Architecture Fix Applied

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public Database(final Construct scope, final String id, final IVpc vpc) {
5858
// Create database security group
5959
databaseSecurityGroup = SecurityGroup.Builder.create(this, "DatabaseSG")
6060
.securityGroupName("workshop-db-sg")
61-
.allowAllOutbound(false)
61+
.allowAllOutbound(true)
6262
.vpc(vpc)
6363
.build();
6464

infra/cfn/base-stack.yaml

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,30 @@ Resources:
714714
Fn::GetAtt:
715715
- IdeInstanceLauncherFunction803C5A2A
716716
- Arn
717-
InstanceTypes: m5.xlarge,m6i.xlarge,t3.xlarge
717+
InstanceName: ide
718+
IamInstanceProfileArn:
719+
Fn::GetAtt:
720+
- IdeIdeInstanceProfile8BD997EA
721+
- Arn
722+
VolumeSize: "50"
723+
SubnetIds:
724+
Fn::Join:
725+
- ""
726+
- - Ref: VpcWorkshopVpcPublicSubnet1SubnetBCB45C45
727+
- ","
728+
- Ref: VpcWorkshopVpcPublicSubnet2SubnetF8F9426F
729+
SecurityGroupIds:
730+
Fn::Join:
731+
- ""
732+
- - Fn::GetAtt:
733+
- IdeIdeSecurityGroup5C503C8A
734+
- GroupId
735+
- ","
736+
- Fn::GetAtt:
737+
- IdeIdeInternalSecurityGroupD5D3B421
738+
- GroupId
739+
ImageId:
740+
Ref: SsmParameterValueawsserviceamiamazonlinuxlatestal2023amikernel61x8664C96584B6F00A464EAD1953AFF4B05118Parameter
718741
UserData:
719742
Fn::Base64:
720743
Fn::Join:
@@ -848,30 +871,7 @@ Resources:
848871
"
849872
exit 1
850873
fi
851-
ImageId:
852-
Ref: SsmParameterValueawsserviceamiamazonlinuxlatestal2023amikernel61x8664C96584B6F00A464EAD1953AFF4B05118Parameter
853-
SecurityGroupIds:
854-
Fn::Join:
855-
- ""
856-
- - Fn::GetAtt:
857-
- IdeIdeSecurityGroup5C503C8A
858-
- GroupId
859-
- ","
860-
- Fn::GetAtt:
861-
- IdeIdeInternalSecurityGroupD5D3B421
862-
- GroupId
863-
SubnetIds:
864-
Fn::Join:
865-
- ""
866-
- - Ref: VpcWorkshopVpcPublicSubnet1SubnetBCB45C45
867-
- ","
868-
- Ref: VpcWorkshopVpcPublicSubnet2SubnetF8F9426F
869-
VolumeSize: "50"
870-
IamInstanceProfileArn:
871-
Fn::GetAtt:
872-
- IdeIdeInstanceProfile8BD997EA
873-
- Arn
874-
InstanceName: ide
874+
InstanceTypes: m5.xlarge,m6i.xlarge,t3.xlarge
875875
UpdateReplacePolicy: Delete
876876
DeletionPolicy: Delete
877877
IdeIdeEipAssociation6C6C215D:
@@ -1452,12 +1452,12 @@ Resources:
14521452
Description: workshop-setup build complete
14531453
EventPattern:
14541454
detail:
1455+
project-name:
1456+
- Ref: CodeBuildProjectA0FF5539
14551457
build-status:
14561458
- SUCCEEDED
14571459
- FAILED
14581460
- STOPPED
1459-
project-name:
1460-
- Ref: CodeBuildProjectA0FF5539
14611461
detail-type:
14621462
- CodeBuild Build State Change
14631463
source:
@@ -1489,13 +1489,13 @@ Resources:
14891489
Fn::GetAtt:
14901490
- CodeBuildStartLambdaFunction8349284F
14911491
- Arn
1492-
ContentHash: "1765715394125"
1492+
ProjectName:
1493+
Ref: CodeBuildProjectA0FF5539
14931494
CodeBuildIamRoleArn:
14941495
Fn::GetAtt:
14951496
- CodeBuildCodeBuildRoleBA9C6D5C
14961497
- Arn
1497-
ProjectName:
1498-
Ref: CodeBuildProjectA0FF5539
1498+
ContentHash: "1765718855273"
14991499
DependsOn:
15001500
- CodeBuildBuildCompleteRuleAllowEventRuleWorkshopStackCodeBuildReportLambdaFunctionD77C6091DA4A4BD8
15011501
- CodeBuildBuildCompleteRule06AAF17D

infra/cfn/java-on-aws-stack.yaml

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,11 @@ Resources:
734734
Fn::GetAtt:
735735
- IdeInstanceLauncherFunction803C5A2A
736736
- Arn
737+
IamInstanceProfileArn:
738+
Fn::GetAtt:
739+
- IdeIdeInstanceProfile8BD997EA
740+
- Arn
741+
VolumeSize: "50"
737742
SubnetIds:
738743
Fn::Join:
739744
- ""
@@ -887,11 +892,6 @@ Resources:
887892
fi
888893
InstanceTypes: m5.xlarge,m6i.xlarge,t3.xlarge
889894
InstanceName: ide
890-
IamInstanceProfileArn:
891-
Fn::GetAtt:
892-
- IdeIdeInstanceProfile8BD997EA
893-
- Arn
894-
VolumeSize: "50"
895895
UpdateReplacePolicy: Delete
896896
DeletionPolicy: Delete
897897
IdeIdeEipAssociation6C6C215D:
@@ -1509,13 +1509,13 @@ Resources:
15091509
Fn::GetAtt:
15101510
- CodeBuildStartLambdaFunction8349284F
15111511
- Arn
1512+
ProjectName:
1513+
Ref: CodeBuildProjectA0FF5539
15121514
CodeBuildIamRoleArn:
15131515
Fn::GetAtt:
15141516
- CodeBuildCodeBuildRoleBA9C6D5C
15151517
- Arn
1516-
ContentHash: "1765715399417"
1517-
ProjectName:
1518-
Ref: CodeBuildProjectA0FF5539
1518+
ContentHash: "1765718860840"
15191519
DependsOn:
15201520
- CodeBuildBuildCompleteRuleAllowEventRuleWorkshopStackCodeBuildReportLambdaFunctionD77C6091DA4A4BD8
15211521
- CodeBuildBuildCompleteRule06AAF17D
@@ -1552,11 +1552,9 @@ Resources:
15521552
GroupDescription: WorkshopStack/Database/DatabaseSG
15531553
GroupName: workshop-db-sg
15541554
SecurityGroupEgress:
1555-
- CidrIp: 255.255.255.255/32
1556-
Description: Disallow all traffic
1557-
FromPort: 252
1558-
IpProtocol: icmp
1559-
ToPort: 86
1555+
- CidrIp: 0.0.0.0/0
1556+
Description: Allow all outbound traffic by default
1557+
IpProtocol: "-1"
15601558
SecurityGroupIngress:
15611559
- CidrIp: 10.0.0.0/16
15621560
Description: Allow Database Traffic from local network

infra/scripts/setup/eks.sh

Lines changed: 10 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -20,44 +20,21 @@ log_info "Region: $REGION, Account: $ACCOUNT_ID"
2020
log_info "Waiting for EKS cluster to be ready..."
2121
wait_for_eks_cluster "$CLUSTER_NAME"
2222

23-
# Update kubeconfig
23+
# Update kubeconfig with infinite retry (like original)
2424
log_info "Updating kubeconfig for cluster $CLUSTER_NAME..."
25-
retry_count=0
26-
max_retries=5
27-
while [ $retry_count -lt $max_retries ]; do
28-
if aws eks --region "$REGION" update-kubeconfig --name "$CLUSTER_NAME"; then
29-
log_success "Successfully updated kubeconfig"
30-
break
31-
else
32-
retry_count=$((retry_count + 1))
33-
log_warning "Failed to update kubeconfig (attempt $retry_count/$max_retries). Retrying in 10 seconds..."
34-
sleep 10
35-
fi
25+
while ! aws eks --region "$REGION" update-kubeconfig --name "$CLUSTER_NAME"; do
26+
log_warning "Failed to update kubeconfig. Retrying in 10 seconds..."
27+
sleep 10
3628
done
29+
log_success "Successfully updated kubeconfig"
3730

38-
if [ $retry_count -eq $max_retries ]; then
39-
log_error "Failed to update kubeconfig after $max_retries attempts"
40-
exit 1
41-
fi
42-
43-
# Verify kubectl connectivity
31+
# Verify kubectl connectivity with infinite retry (like original)
4432
log_info "Verifying kubectl connectivity..."
45-
retry_count=0
46-
while [ $retry_count -lt $max_retries ]; do
47-
if kubectl get ns >/dev/null 2>&1; then
48-
log_success "kubectl connectivity verified"
49-
break
50-
else
51-
retry_count=$((retry_count + 1))
52-
log_warning "kubectl connectivity failed (attempt $retry_count/$max_retries). Retrying in 10 seconds..."
53-
sleep 10
54-
fi
33+
while ! kubectl get ns >/dev/null 2>&1; do
34+
log_warning "kubectl connectivity failed. Retrying in 10 seconds..."
35+
sleep 10
5536
done
56-
57-
if [ $retry_count -eq $max_retries ]; then
58-
log_error "kubectl connectivity failed after $max_retries attempts"
59-
exit 1
60-
fi
37+
log_success "kubectl connectivity verified"
6138

6239
# Deploy GP3 StorageClass (encrypted, default)
6340
log_info "Deploying GP3 StorageClass..."

0 commit comments

Comments
 (0)