@@ -4,13 +4,13 @@ Description: Provision an instance of the Javabuilder service. Empty the Content
4
4
Parameters:
5
5
BaseDomainName:
6
6
Type: String
7
- Description: Base domain name.
7
+ Description: Base domain name (e.g. 'code.org' in 'javabuilder.code.org') .
8
8
BaseDomainNameHostedZonedID:
9
9
Type: String
10
10
Description: AWS Route53 Hosted Zone ID for base domain name.
11
- SubDomainName :
11
+ SubdomainName :
12
12
Type: String
13
- Description: Sub domain name for javabuilder service.
13
+ Description: Subdomain name for javabuilder service (e.g. 'javabuilder' in 'javabuilder.code.org') .
14
14
# LogBucket:
15
15
# Type: String
16
16
# Default: cdo-logs.s3.amazonaws.com
@@ -76,7 +76,7 @@ Resources:
76
76
Type: AWS::Route53::RecordSet
77
77
Properties:
78
78
HostedZoneName: !Sub "${BaseDomainName}."
79
- Name: !Sub "${SubDomainName }<%= config[:Suffix]%> .${BaseDomainName}"
79
+ Name: !Sub "${SubdomainName }<%= config[:Suffix]%> .${BaseDomainName}"
80
80
Type: A
81
81
AliasTarget:
82
82
DNSName: !GetAtt <%= config[:Prefix]%> DomainName.RegionalDomainName
@@ -85,19 +85,19 @@ Resources:
85
85
<%= config[:Prefix]%> DomainName:
86
86
Type: AWS::ApiGatewayV2::DomainName
87
87
Properties:
88
- DomainName: !Sub "${SubDomainName }<%= config[:Suffix]%> .${BaseDomainName}"
88
+ DomainName: !Sub "${SubdomainName }<%= config[:Suffix]%> .${BaseDomainName}"
89
89
DomainNameConfigurations:
90
90
- EndpointType: REGIONAL
91
91
CertificateArn: !Ref <%= config[:Prefix]%> Certificate
92
- CertificateName: !Sub "${SubDomainName }<%= config[:Suffix]%> .${BaseDomainName}"
92
+ CertificateName: !Sub "${SubdomainName }<%= config[:Suffix]%> .${BaseDomainName}"
93
93
94
94
<%= config[:Prefix]%> Certificate:
95
95
Type: AWS::CertificateManager::Certificate
96
96
Properties:
97
- DomainName: !Sub "${SubDomainName }<%= config[:Suffix]%> .${BaseDomainName}"
97
+ DomainName: !Sub "${SubdomainName }<%= config[:Suffix]%> .${BaseDomainName}"
98
98
ValidationMethod: DNS
99
99
DomainValidationOptions:
100
- - DomainName: !Sub "${SubDomainName }<%= config[:Suffix]%> .${BaseDomainName}"
100
+ - DomainName: !Sub "${SubdomainName }<%= config[:Suffix]%> .${BaseDomainName}"
101
101
HostedZoneId: !Ref BaseDomainNameHostedZonedID
102
102
103
103
<%= config[:Prefix]%> DomainNameAPIMapping:
@@ -106,14 +106,14 @@ Resources:
106
106
- <%= config[:Prefix]%> Domain
107
107
Properties:
108
108
ApiId: !Ref <%= apiName%> API
109
- DomainName: !Sub "${SubDomainName }<%= config[:Suffix]%> .${BaseDomainName}"
109
+ DomainName: !Sub "${SubdomainName }<%= config[:Suffix]%> .${BaseDomainName}"
110
110
Stage: !Ref <%= apiName%> Stage
111
111
112
112
<% end -%>
113
113
HttpAPI:
114
114
Type: AWS::ApiGatewayV2::Api
115
115
Properties:
116
- Name: !Sub "${SubDomainName }-http.${BaseDomainName}"
116
+ Name: !Sub "${SubdomainName }-http.${BaseDomainName}"
117
117
ProtocolType: HTTP
118
118
119
119
PutRoute:
@@ -165,7 +165,7 @@ Resources:
165
165
HttpStageLogs:
166
166
Type: AWS::Logs::LogGroup
167
167
Properties:
168
- LogGroupName: !Sub "/aws/apigateway/accesslog/${SubDomainName }-http.${BaseDomainName}"
168
+ LogGroupName: !Sub "/aws/apigateway/accesslog/${SubdomainName }-http.${BaseDomainName}"
169
169
170
170
HttpStage:
171
171
Type: AWS::ApiGatewayV2::Stage
@@ -179,7 +179,7 @@ Resources:
179
179
DefaultRouteSettings:
180
180
DetailedMetricsEnabled: true
181
181
AccessLogSettings:
182
- DestinationArn: !Sub "arn:aws:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/apigateway/accesslog/${SubDomainName }-http.${BaseDomainName}"
182
+ DestinationArn: !Sub "arn:aws:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/apigateway/accesslog/${SubdomainName }-http.${BaseDomainName}"
183
183
# TODO: Also log authorizer status code, authorizer error message, Javabuilder session id, and Origin.
184
184
Format: '{
185
185
"host": "$context.domainName",
@@ -216,7 +216,7 @@ Resources:
216
216
WebSocketAPI:
217
217
Type: AWS::ApiGatewayV2::Api
218
218
Properties:
219
- Name: !Sub "${SubDomainName }.${BaseDomainName}"
219
+ Name: !Sub "${SubdomainName }.${BaseDomainName}"
220
220
ProtocolType: WEBSOCKET
221
221
RouteSelectionExpression: "$request.body.action"
222
222
@@ -317,7 +317,7 @@ Resources:
317
317
LoggingLevel: INFO
318
318
DataTraceEnabled: true
319
319
AccessLogSettings:
320
- DestinationArn: !Sub "arn:aws:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/apigateway/accesslog/${SubDomainName }.${BaseDomainName}"
320
+ DestinationArn: !Sub "arn:aws:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/apigateway/accesslog/${SubdomainName }.${BaseDomainName}"
321
321
# TODO: Also log authorizer status code, authorizer error message, Javabuilder session id, and Origin.
322
322
Format: '{
323
323
"host": "$context.domainName",
@@ -470,7 +470,7 @@ Resources:
470
470
ContentBucket:
471
471
Type: AWS::S3::Bucket
472
472
Properties:
473
- BucketName: !If [IsDevCondition, !Sub "cdo-dev-${SubDomainName }-content", !Sub "cdo-${SubDomainName }-content"]
473
+ BucketName: !If [IsDevCondition, !Sub "cdo-dev-${SubdomainName }-content", !Sub "cdo-${SubdomainName }-content"]
474
474
CorsConfiguration:
475
475
CorsRules:
476
476
- AllowedMethods: [GET, PUT]
@@ -500,17 +500,17 @@ Resources:
500
500
ContentAPICertificate:
501
501
Type: AWS::CertificateManager::Certificate
502
502
Properties:
503
- DomainName: !Sub "${SubDomainName }-content.${BaseDomainName}"
503
+ DomainName: !Sub "${SubdomainName }-content.${BaseDomainName}"
504
504
ValidationMethod: DNS
505
505
DomainValidationOptions:
506
- - DomainName: !Sub "${SubDomainName }-content.${BaseDomainName}"
506
+ - DomainName: !Sub "${SubdomainName }-content.${BaseDomainName}"
507
507
HostedZoneId: !Ref BaseDomainNameHostedZonedID
508
508
509
509
ContentDomain:
510
510
Type: AWS::Route53::RecordSet
511
511
Properties:
512
512
HostedZoneName: !Sub "${BaseDomainName}."
513
- Name: !Sub "${SubDomainName }-content.${BaseDomainName}"
513
+ Name: !Sub "${SubdomainName }-content.${BaseDomainName}"
514
514
Type: A
515
515
AliasTarget:
516
516
DNSName: !GetAtt ContentCDN.DomainName
@@ -521,7 +521,7 @@ Resources:
521
521
Properties:
522
522
DistributionConfig:
523
523
Enabled: true
524
- Aliases: [!Sub "${SubDomainName }-content.${BaseDomainName}"]
524
+ Aliases: [!Sub "${SubdomainName }-content.${BaseDomainName}"]
525
525
ViewerCertificate:
526
526
AcmCertificateArn: !Ref ContentAPICertificate
527
527
MinimumProtocolVersion: TLSv1
@@ -533,7 +533,7 @@ Resources:
533
533
# Logging:
534
534
# Bucket: !Ref LogBucket
535
535
# IncludeCookies: false
536
- # Prefix: !Sub "${SubDomainName }-content.${BaseDomainName}"
536
+ # Prefix: !Sub "${SubdomainName }-content.${BaseDomainName}"
537
537
Origins:
538
538
- Id: ContentBucket
539
539
DomainName: !GetAtt ContentBucket.DomainName
@@ -549,7 +549,7 @@ Resources:
549
549
HighConcurrentExecutionsAlarm:
550
550
Type: AWS::CloudWatch::Alarm
551
551
Properties:
552
- AlarmName: !Sub "${SubDomainName }_high_concurrent_executions"
552
+ AlarmName: !Sub "${SubdomainName }_high_concurrent_executions"
553
553
AlarmDescription: !Sub |
554
554
This will page the DOTD if javabuilder usage exceeds 50 concurrent
555
555
executions for 10 minutes. Occasional spikes are expected, but
@@ -589,7 +589,7 @@ Resources:
589
589
HighWebsocketConnectionsAlarm:
590
590
Type: AWS::CloudWatch::Alarm
591
591
Properties:
592
- AlarmName: !Sub "${SubDomainName }_high_websocket_connections"
592
+ AlarmName: !Sub "${SubdomainName }_high_websocket_connections"
593
593
AlarmDescription: Significantly higher websocket connections than normal detected. Investigate if there is a DDOS.
594
594
ActionsEnabled: false
595
595
EvaluationPeriods: 20
@@ -619,7 +619,7 @@ Resources:
619
619
HighHttpRequestsAlarm:
620
620
Type: AWS::CloudWatch::Alarm
621
621
Properties:
622
- AlarmName: !Sub "${SubDomainName }_high_http_requests"
622
+ AlarmName: !Sub "${SubdomainName }_high_http_requests"
623
623
AlarmDescription: Significantly higher HTTP requests than normal detected.
624
624
Investigate if there is a DDOS.
625
625
ActionsEnabled: true
@@ -664,12 +664,12 @@ Resources:
664
664
AlarmDescription: Send message if abnormally high Javabuilder usage detected.
665
665
Monitors usage across the HTTP API, WebSocket API, and all Build and Run
666
666
Lambdas.
667
- AlarmName: !Sub "${SubDomainName }_high_usage_composite"
668
- AlarmRule: !Sub "ALARM(${SubDomainName }_console_high_invocations) OR
669
- ALARM(${SubDomainName }_high_http_requests) OR
670
- ALARM(${SubDomainName }_high_websocket_connections) OR
671
- ALARM(${SubDomainName }_neighborhood_high_invocations) OR
672
- ALARM(${SubDomainName }_theater_high_invocations)"
667
+ AlarmName: !Sub "${SubdomainName }_high_usage_composite"
668
+ AlarmRule: !Sub "ALARM(${SubdomainName }_console_high_invocations) OR
669
+ ALARM(${SubdomainName }_high_http_requests) OR
670
+ ALARM(${SubdomainName }_high_websocket_connections) OR
671
+ ALARM(${SubdomainName }_neighborhood_high_invocations) OR
672
+ ALARM(${SubdomainName }_theater_high_invocations)"
673
673
InsufficientDataActions: []
674
674
OKActions: []
675
675
@@ -678,7 +678,7 @@ Resources:
678
678
<%= name%> HighSevereErrorRateAlarm:
679
679
Type: AWS::CloudWatch::Alarm
680
680
Properties:
681
- AlarmName: !Sub "${SubDomainName }_<%= name . downcase%> _high_severe_error_rate"
681
+ AlarmName: !Sub "${SubdomainName }_<%= name . downcase%> _high_severe_error_rate"
682
682
AlarmDescription: Send page if Javabuilder severe error rate exceeds 10% for 20
683
683
minutes. Occasional spikes are expected, but a sustained high error rate
684
684
is an indication of an outage.
@@ -721,7 +721,7 @@ Resources:
721
721
<%= name%> HighErrorRateAlarm:
722
722
Type: AWS::CloudWatch::Alarm
723
723
Properties:
724
- AlarmName: !Sub "${SubDomainName }_build_and_run_<%= name . downcase%> _lambda_error_rate"
724
+ AlarmName: !Sub "${SubdomainName }_build_and_run_<%= name . downcase%> _lambda_error_rate"
725
725
AlarmDescription: Error rate in Javabuilder's <%= name%> build and run lambda (the core of
726
726
Javabuilder, which executes student <%= name%> code) exceeded 10% for four
727
727
consecutive 5 minute periods.
@@ -775,7 +775,7 @@ Resources:
775
775
<%= name%> SlowCleanupTimeAlarm:
776
776
Type: AWS::CloudWatch::Alarm
777
777
Properties:
778
- AlarmName: !Sub "${SubDomainName }_<%= name . downcase%> _slow_cleanup_time"
778
+ AlarmName: !Sub "${SubdomainName }_<%= name . downcase%> _slow_cleanup_time"
779
779
AlarmDescription: Average cleanup time in Javabuilder's <%= name%> build and run lambda was high for at
780
780
least 15 out of the last 20 minutes. Investigate if there has been a performance regression.
781
781
ActionsEnabled: true
@@ -799,7 +799,7 @@ Resources:
799
799
<%= name%> SlowColdBootTimeAlarm:
800
800
Type: AWS::CloudWatch::Alarm
801
801
Properties:
802
- AlarmName: !Sub "${SubDomainName }_<%= name . downcase%> _slow_cold_boot_time"
802
+ AlarmName: !Sub "${SubdomainName }_<%= name . downcase%> _slow_cold_boot_time"
803
803
AlarmDescription: Average cold boot time in Javabuilder's <%= name%> build and run lambda was high for at
804
804
least 15 out of the last 20 minutes. Investigate if there has been a performance regression.
805
805
ActionsEnabled: true
@@ -823,7 +823,7 @@ Resources:
823
823
<%= name%> SlowInitializationTimeAlarm:
824
824
Type: AWS::CloudWatch::Alarm
825
825
Properties:
826
- AlarmName: !Sub "${SubDomainName }_<%= name . downcase%> _slow_initialization_time"
826
+ AlarmName: !Sub "${SubdomainName }_<%= name . downcase%> _slow_initialization_time"
827
827
AlarmDescription: Average initialization time in Javabuilder's <%= name%> build and run lambda was high for at
828
828
least 15 out of the last 20 minutes. Investigate if there has been a performance regression.
829
829
ActionsEnabled: true
@@ -848,7 +848,7 @@ Resources:
848
848
<%= name%> SlowTransitionTimeAlarm:
849
849
Type: AWS::CloudWatch::Alarm
850
850
Properties:
851
- AlarmName: !Sub "${SubDomainName }_<%= name . downcase%> _slow_transition_time"
851
+ AlarmName: !Sub "${SubdomainName }_<%= name . downcase%> _slow_transition_time"
852
852
AlarmDescription: Average transition time in Javabuilder's <%= name%> build and run lambda was high for at
853
853
least 15 out of the last 20 minutes. Investigate if there has been a performance regression.
854
854
ActionsEnabled: true
@@ -872,7 +872,7 @@ Resources:
872
872
<%= name%> HighInvocationsAlarm:
873
873
Type: AWS::CloudWatch::Alarm
874
874
Properties:
875
- AlarmName: !Sub "${SubDomainName }_<%= name . downcase%> _high_invocations"
875
+ AlarmName: !Sub "${SubdomainName }_<%= name . downcase%> _high_invocations"
876
876
AlarmDescription: Significantly higher <%= name%> build and run invocations than
877
877
normal detected. Investigate if there is a DDOS.
878
878
ActionsEnabled: false
@@ -915,7 +915,7 @@ Resources:
915
915
BlockedUsersTable:
916
916
Type: AWS::DynamoDB::Table
917
917
Properties:
918
- TableName: !Sub "${SubDomainName }_blocked_users"
918
+ TableName: !Sub "${SubdomainName }_blocked_users"
919
919
KeySchema:
920
920
- AttributeName: <%= DOMAIN_AND_USER_ID_COMPOSITE_ATTRIBUTE_NAME%>
921
921
KeyType: HASH
@@ -929,7 +929,7 @@ Resources:
929
929
TokenStatusTable:
930
930
Type: AWS::DynamoDB::Table
931
931
Properties:
932
- TableName: !Sub "${SubDomainName }_tokens"
932
+ TableName: !Sub "${SubdomainName }_tokens"
933
933
KeySchema:
934
934
- AttributeName: <%= TOKEN_ID_ATTRIBUTE_NAME%>
935
935
KeyType: HASH
@@ -944,7 +944,7 @@ Resources:
944
944
UserRequestsTable:
945
945
Type: AWS::DynamoDB::Table
946
946
Properties:
947
- TableName: !Sub "${SubDomainName }_user_requests"
947
+ TableName: !Sub "${SubdomainName }_user_requests"
948
948
KeySchema:
949
949
- AttributeName: <%= DOMAIN_AND_USER_ID_COMPOSITE_ATTRIBUTE_NAME%>
950
950
KeyType: HASH
@@ -963,7 +963,7 @@ Resources:
963
963
TeacherAssociatedRequestsTable:
964
964
Type: AWS::DynamoDB::Table
965
965
Properties:
966
- TableName: !Sub "${SubDomainName }_teacher_associated_requests"
966
+ TableName: !Sub "${SubdomainName }_teacher_associated_requests"
967
967
KeySchema:
968
968
- AttributeName: <%= DOMAIN_AND_SECTION_OWNER_ID_COMPOSITE_ATTRIBUTE_NAME%>
969
969
KeyType: HASH
@@ -982,7 +982,7 @@ Resources:
982
982
HighUsersBlockedAlarm:
983
983
Type: AWS::CloudWatch::Alarm
984
984
Properties:
985
- AlarmName: !Sub "${SubDomainName }_high_users_blocked"
985
+ AlarmName: !Sub "${SubdomainName }_high_users_blocked"
986
986
AlarmDescription: Unusually high number of users being blocked by our throttling
987
987
thresholds.
988
988
ActionsEnabled: true
@@ -1006,7 +1006,7 @@ Resources:
1006
1006
HighClassroomsBlockedAlarm:
1007
1007
Type: AWS::CloudWatch::Alarm
1008
1008
Properties:
1009
- AlarmName: !Sub "${SubDomainName }_high_classrooms_blocked"
1009
+ AlarmName: !Sub "${SubdomainName }_high_classrooms_blocked"
1010
1010
AlarmDescription: Unusually high number of classrooms being blocked by our throttling
1011
1011
thresholds.
1012
1012
ActionsEnabled: true
@@ -1030,7 +1030,7 @@ Resources:
1030
1030
HighUnknownTokensAlarm:
1031
1031
Type: AWS::CloudWatch::Alarm
1032
1032
Properties:
1033
- AlarmName: !Sub "${SubDomainName }_high_unknown_tokens"
1033
+ AlarmName: !Sub "${SubdomainName }_high_unknown_tokens"
1034
1034
AlarmDescription: Websocket authorizer is receiving connection requests using
1035
1035
tokens that did not pass through the HTTP authorizer first.
1036
1036
ActionsEnabled: true
@@ -1054,7 +1054,7 @@ Resources:
1054
1054
HighUnvettedTokensAlarm:
1055
1055
Type: AWS::CloudWatch::Alarm
1056
1056
Properties:
1057
- AlarmName: !Sub "${SubDomainName }_high_unvetted_tokens"
1057
+ AlarmName: !Sub "${SubdomainName }_high_unvetted_tokens"
1058
1058
AlarmDescription: Websocket authorizer is receiving connection requests using
1059
1059
tokens that were observed but not vetted as valid by the HTTP authorizer.
1060
1060
ActionsEnabled: true
@@ -1078,7 +1078,7 @@ Resources:
1078
1078
WebsocketHighUsedTokensAlarm:
1079
1079
Type: AWS::CloudWatch::Alarm
1080
1080
Properties:
1081
- AlarmName: !Sub "${SubDomainName }_websocket_high_used_tokens"
1081
+ AlarmName: !Sub "${SubdomainName }_websocket_high_used_tokens"
1082
1082
AlarmDescription: Websocket authorizer is receiving connection requests using
1083
1083
tokens have already been used.
1084
1084
ActionsEnabled: true
@@ -1102,7 +1102,7 @@ Resources:
1102
1102
HttpHighUsedTokensAlarm:
1103
1103
Type: AWS::CloudWatch::Alarm
1104
1104
Properties:
1105
- AlarmName: !Sub "${SubDomainName }_http_high_used_tokens"
1105
+ AlarmName: !Sub "${SubdomainName }_http_high_used_tokens"
1106
1106
AlarmDescription: HTTP authorizer is receiving connection requests using
1107
1107
tokens have already been used.
1108
1108
ActionsEnabled: true
@@ -1126,4 +1126,4 @@ Resources:
1126
1126
Outputs:
1127
1127
JavabuilderURL:
1128
1128
Value:
1129
- Fn::Sub: wss://${SubDomainName }.${BaseDomainName}
1129
+ Fn::Sub: wss://${SubdomainName }.${BaseDomainName}
0 commit comments