@@ -777,6 +777,12 @@ Resources:
777777 Fn::GetAtt :
778778 - IdeInstanceLauncherFunction803C5A2A
779779 - Arn
780+ IamInstanceProfileArn :
781+ Fn::GetAtt :
782+ - IdeInstanceProfile61B92038
783+ - Arn
784+ InstanceName : ide
785+ InstanceTypes : m7g.xlarge,m6g.xlarge,c7g.xlarge,t4g.xlarge
780786 UserData :
781787 Fn::Base64 :
782788 Fn::Join :
@@ -913,19 +919,8 @@ Resources:
913919 "
914920 exit 1
915921 fi
916- InstanceTypes : m7g.xlarge,m6g.xlarge,c7g.xlarge,t4g.xlarge
917- InstanceName : ide
918- IamInstanceProfileArn :
919- Fn::GetAtt :
920- - IdeInstanceProfile61B92038
921- - Arn
922- VolumeSize : " 50"
923- SubnetIds :
924- Fn::Join :
925- - " "
926- - - Ref : VpcPublicSubnet1Subnet8E8DEDC0
927- - " ,"
928- - Ref : VpcPublicSubnet2SubnetA811849C
922+ ImageId :
923+ Ref : SsmParameterValueawsserviceamiamazonlinuxlatestal2023amikernel61arm64C96584B6F00A464EAD1953AFF4B05118Parameter
929924 SecurityGroupIds :
930925 Fn::Join :
931926 - " "
@@ -936,8 +931,13 @@ Resources:
936931 - Fn::GetAtt :
937932 - IdeInternalSecurityGroupB0A5D76B
938933 - GroupId
939- ImageId :
940- Ref : SsmParameterValueawsserviceamiamazonlinuxlatestal2023amikernel61arm64C96584B6F00A464EAD1953AFF4B05118Parameter
934+ SubnetIds :
935+ Fn::Join :
936+ - " "
937+ - - Ref : VpcPublicSubnet1Subnet8E8DEDC0
938+ - " ,"
939+ - Ref : VpcPublicSubnet2SubnetA811849C
940+ VolumeSize : " 50"
941941 UpdateReplacePolicy : Delete
942942 DeletionPolicy : Delete
943943 IdeEipAssociationDFF81215 :
@@ -1526,12 +1526,12 @@ Resources:
15261526 Description : workshop-setup build complete
15271527 EventPattern :
15281528 detail :
1529- project-name :
1530- - Ref : CodeBuildProjectA0FF5539
15311529 build-status :
15321530 - SUCCEEDED
15331531 - FAILED
15341532 - STOPPED
1533+ project-name :
1534+ - Ref : CodeBuildProjectA0FF5539
15351535 detail-type :
15361536 - CodeBuild Build State Change
15371537 source :
@@ -1563,13 +1563,13 @@ Resources:
15631563 Fn::GetAtt :
15641564 - CodeBuildStartLambdaFunction8349284F
15651565 - Arn
1566- ContentHash : " 1766247608818"
1567- ProjectName :
1568- Ref : CodeBuildProjectA0FF5539
1566+ ContentHash : " 1766254404082"
15691567 CodeBuildIamRoleArn :
15701568 Fn::GetAtt :
15711569 - CodeBuildRoleE9A44575
15721570 - Arn
1571+ ProjectName :
1572+ Ref : CodeBuildProjectA0FF5539
15731573 DependsOn :
15741574 - CodeBuildCompleteRuleAllowEventRuleWorkshopStackCodeBuildReportLambdaFunctionD77C60919E0B0C89
15751575 - CodeBuildCompleteRuleEE9277E8
@@ -1921,7 +1921,7 @@ Resources:
19211921 - Ref : AWS::AccountId
19221922 - " -"
19231923 - Ref : AWS::Region
1924- - " -20251220172009 "
1924+ - " -20251220191324 "
19251925 PublicAccessBlockConfiguration :
19261926 BlockPublicAcls : true
19271927 BlockPublicPolicy : true
@@ -2157,15 +2157,15 @@ Resources:
21572157 }
21582158 Environment :
21592159 Variables :
2160- KUBERNETES_AUTH_TYPE : aws
2161- APP_LABEL : unicorn-store-spring
2162- K8S_NAMESPACE : unicorn-store-spring
21632160 S3_THREAD_DUMPS_PREFIX : thread-dumps/
2164- EKS_CLUSTER_NAME :
2165- Ref : EksClusterB2BDED5B
2161+ K8S_NAMESPACE : unicorn-store-spring
2162+ APP_LABEL : unicorn-store-spring
2163+ KUBERNETES_AUTH_TYPE : aws
2164+ SECRET_NAME : workshop-ide-password
21662165 S3_BUCKET_NAME :
21672166 Ref : WorkshopBucketFD5BC43F
2168- SECRET_NAME : workshop-ide-password
2167+ EKS_CLUSTER_NAME :
2168+ Ref : EksClusterB2BDED5B
21692169 FunctionName : workshop-thread-dump-lambda
21702170 Handler : index.lambda_handler
21712171 MemorySize : 512
@@ -2709,6 +2709,9 @@ Resources:
27092709 Fn::GetAtt :
27102710 - UnicornUnicornStoreDatabaseSetupFunction04E12F8B
27112711 - Arn
2712+ SqlStatements : |
2713+ CREATE TABLE IF NOT EXISTS unicorns(id TEXT DEFAULT gen_random_uuid() PRIMARY KEY, name TEXT, age TEXT, size TEXT, type TEXT);
2714+ CREATE EXTENSION IF NOT EXISTS vector;
27122715 SecretName :
27132716 Fn::Join :
27142717 - " -"
@@ -2739,9 +2742,6 @@ Resources:
27392742 - Fn::Split :
27402743 - " :"
27412744 - Ref : DatabaseSecret3B817195
2742- SqlStatements : |
2743- CREATE TABLE IF NOT EXISTS unicorns(id TEXT DEFAULT gen_random_uuid() PRIMARY KEY, name TEXT, age TEXT, size TEXT, type TEXT);
2744- CREATE EXTENSION IF NOT EXISTS vector;
27452745 DependsOn :
27462746 - DatabaseClusterDatabaseWriterF4C0B9A6
27472747 - DatabaseCluster5B53A178
@@ -2774,8 +2774,6 @@ Resources:
27742774 - ec2:DeleteVpcEndpoints
27752775 - ec2:DescribeSecurityGroups
27762776 - ec2:DescribeVpcEndpoints
2777- - logs:DeleteLogGroup
2778- - logs:DescribeLogGroups
27792777 - s3:DeleteObject
27802778 - s3:DeleteObjectVersion
27812779 - s3:ListAllMyBuckets
@@ -2797,7 +2795,6 @@ Resources:
27972795 import cfnresponse
27982796
27992797 ec2 = boto3.client('ec2')
2800- logs = boto3.client('logs')
28012798 s3 = boto3.client('s3')
28022799 s3_resource = boto3.resource('s3')
28032800
@@ -2806,8 +2803,8 @@ Resources:
28062803 Custom Resource handler to cleanup resources before stack deletion.
28072804 - GuardDuty VPC endpoints that block VPC deletion
28082805 - GuardDuty managed security groups
2809- - CloudWatch log groups with workshop- or unicornstore- prefix
28102806 - S3 bucket contents for workshop- buckets
2807+ Note: CloudWatch logs are kept for debugging/analysis
28112808 """
28122809 print(f"Event: {event}")
28132810
@@ -2819,8 +2816,7 @@ Resources:
28192816 # Start VPC endpoint deletion (async)
28202817 endpoint_ids = start_guardduty_endpoint_deletion(vpc_id)
28212818
2822- # While endpoints are deleting, clean up logs and S3
2823- cleanup_cloudwatch_logs()
2819+ # While endpoints are deleting, clean up S3
28242820 cleanup_s3_buckets()
28252821
28262822 # Wait for VPC endpoint deletion to complete
@@ -2899,26 +2895,6 @@ Resources:
28992895
29002896 print("GuardDuty security group cleanup completed")
29012897
2902- def cleanup_cloudwatch_logs():
2903- """Delete CloudWatch log groups with workshop- or unicornstore- prefix."""
2904- prefixes = ['workshop-', 'unicornstore-', '/aws/lambda/workshop-', '/aws/lambda/unicornstore-']
2905-
2906- for prefix in prefixes:
2907- try:
2908- paginator = logs.get_paginator('describe_log_groups')
2909- for page in paginator.paginate(logGroupNamePrefix=prefix):
2910- for log_group in page.get('logGroups', []):
2911- log_group_name = log_group['logGroupName']
2912- print(f"Deleting log group: {log_group_name}")
2913- try:
2914- logs.delete_log_group(logGroupName=log_group_name)
2915- except Exception as e:
2916- print(f"Error deleting log group {log_group_name}: {e}")
2917- except Exception as e:
2918- print(f"Error listing log groups with prefix {prefix}: {e}")
2919-
2920- print("CloudWatch log cleanup completed")
2921-
29222898 def cleanup_s3_buckets():
29232899 """Empty S3 buckets with workshop- prefix."""
29242900 try:
0 commit comments