@restatedev/restate-cdk 0.4.2 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,932 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`Restate constructs Create a self-hosted Restate environment deployed on EC2 1`] = `
4
+ "Resources:
5
+ RestateInstanceRoleACC59A6F:
6
+ Type: 'AWS::IAM::Role'
7
+ Properties:
8
+ AssumeRolePolicyDocument:
9
+ Statement:
10
+ - Action: 'sts:AssumeRole'
11
+ Effect: Allow
12
+ Principal:
13
+ Service: ec2.amazonaws.com
14
+ Version: '2012-10-17'
15
+ ManagedPolicyArns:
16
+ - 'Fn::Join':
17
+ - ''
18
+ - - 'arn:'
19
+ - Ref: 'AWS::Partition'
20
+ - ':iam::aws:policy/AmazonSSMManagedInstanceCore'
21
+ RestateInstanceRoleDefaultPolicyD1D39538:
22
+ Type: 'AWS::IAM::Policy'
23
+ Properties:
24
+ PolicyDocument:
25
+ Statement:
26
+ - Action:
27
+ - 'logs:CreateLogStream'
28
+ - 'logs:PutLogEvents'
29
+ Effect: Allow
30
+ Resource:
31
+ 'Fn::GetAtt':
32
+ - RestateLogsFD86ECAE
33
+ - Arn
34
+ Version: '2012-10-17'
35
+ PolicyName: RestateInstanceRoleDefaultPolicyD1D39538
36
+ Roles:
37
+ - Ref: RestateInstanceRoleACC59A6F
38
+ RestateLogsFD86ECAE:
39
+ Type: 'AWS::Logs::LogGroup'
40
+ Properties:
41
+ LogGroupName: /restate/Restate
42
+ RetentionInDays: 30
43
+ UpdateReplacePolicy: Delete
44
+ DeletionPolicy: Delete
45
+ RestateHostInstanceSecurityGroup471D630B:
46
+ Type: 'AWS::EC2::SecurityGroup'
47
+ Properties:
48
+ GroupDescription: RestateOnFargateStack/Restate/Host/InstanceSecurityGroup
49
+ SecurityGroupEgress:
50
+ - CidrIp: 0.0.0.0/0
51
+ Description: Allow all outbound traffic by default
52
+ IpProtocol: '-1'
53
+ Tags:
54
+ - Key: Name
55
+ Value: RestateOnFargateStack/Restate/Host
56
+ VpcId: vpc-12345
57
+ RestateHostInstanceProfile14AE3AC8:
58
+ Type: 'AWS::IAM::InstanceProfile'
59
+ Properties:
60
+ Roles:
61
+ - Ref: RestateInstanceRoleACC59A6F
62
+ RestateHost1AC4F9D1:
63
+ Type: 'AWS::EC2::Instance'
64
+ Properties:
65
+ AvailabilityZone: dummy1a
66
+ IamInstanceProfile:
67
+ Ref: RestateHostInstanceProfile14AE3AC8
68
+ ImageId:
69
+ Ref: >-
70
+ SsmParameterValueawsserviceamiamazonlinuxlatestal2023amikernel61arm64C96584B6F00A464EAD1953AFF4B05118Parameter
71
+ InstanceType: t4g.micro
72
+ SecurityGroupIds:
73
+ - 'Fn::GetAtt':
74
+ - RestateHostInstanceSecurityGroup471D630B
75
+ - GroupId
76
+ - 'Fn::GetAtt':
77
+ - RestateRestateSecurityGroup73273B13
78
+ - GroupId
79
+ SubnetId: s-12345
80
+ Tags:
81
+ - Key: Name
82
+ Value: RestateOnFargateStack/Restate/Host
83
+ UserData:
84
+ 'Fn::Base64':
85
+ 'Fn::Join':
86
+ - ''
87
+ - - >-
88
+ #!/bin/bash
89
+
90
+ yum update -y
91
+
92
+ yum install -y docker nginx
93
+
94
+ systemctl enable docker.service
95
+
96
+ systemctl start docker.service
97
+
98
+ docker run --name adot --restart unless-stopped --detach -p
99
+ 4317:4317 -p 55680:55680 -p 8889:8888
100
+ public.ecr.aws/aws-observability/aws-otel-collector:latest
101
+
102
+ docker run --name restate --restart unless-stopped --detach
103
+ --volume /var/restate:/target --network=host -e
104
+ RESTATE_OBSERVABILITY__LOG__FORMAT=Json -e
105
+ RUST_LOG=info,restate_worker::partition=warn -e
106
+ RESTATE_OBSERVABILITY__TRACING__ENDPOINT=http://localhost:4317
107
+ --log-driver=awslogs --log-opt awslogs-group=
108
+ - Ref: RestateLogsFD86ECAE
109
+ - >2-
110
+ docker.io/restatedev/restate:latest
111
+ mkdir -p /etc/pki/private
112
+
113
+ openssl req -new -x509 -nodes -sha256 -days 365 -extensions
114
+ v3_ca -subj
115
+ '/C=DE/ST=Berlin/L=Berlin/O=restate.dev/OU=demo/CN=restate.example.com'
116
+ -newkey rsa:2048 -keyout /etc/pki/private/restate-selfsigned.key
117
+ -out /etc/pki/private/restate-selfsigned.crt
118
+
119
+ cat << EOF > /etc/nginx/conf.d/restate-ingress.conf
120
+
121
+ server {
122
+ listen 443 ssl http2;
123
+ listen [::]:443 ssl http2;
124
+ server_name _;
125
+ root /usr/share/nginx/html;
126
+
127
+ ssl_certificate "/etc/pki/private/restate-selfsigned.crt";
128
+ ssl_certificate_key "/etc/pki/private/restate-selfsigned.key";
129
+ ssl_session_cache shared:SSL:1m;
130
+ ssl_session_timeout 10m;
131
+ ssl_ciphers PROFILE=SYSTEM;
132
+ ssl_prefer_server_ciphers on;
133
+
134
+ location / {
135
+ proxy_pass http://localhost:8080;
136
+ }
137
+ }
138
+
139
+
140
+ server {
141
+ listen 9073 ssl http2;
142
+ listen [::]:9073 ssl http2;
143
+ server_name _;
144
+ root /usr/share/nginx/html;
145
+
146
+ ssl_certificate "/etc/pki/private/restate-selfsigned.crt";
147
+ ssl_certificate_key "/etc/pki/private/restate-selfsigned.key";
148
+ ssl_session_cache shared:SSL:1m;
149
+ ssl_session_timeout 10m;
150
+ ssl_ciphers PROFILE=SYSTEM;
151
+ ssl_prefer_server_ciphers on;
152
+
153
+ location / {
154
+ proxy_pass http://localhost:9070;
155
+ }
156
+ }
157
+
158
+ EOF
159
+
160
+ systemctl enable nginx
161
+
162
+ systemctl start nginx
163
+ DependsOn:
164
+ - RestateInstanceRoleDefaultPolicyD1D39538
165
+ - RestateInstanceRoleACC59A6F
166
+ RestateRestateSecurityGroup73273B13:
167
+ Type: 'AWS::EC2::SecurityGroup'
168
+ Properties:
169
+ GroupDescription: Restate service ACLs
170
+ GroupName: RestateSecurityGroup
171
+ SecurityGroupEgress:
172
+ - CidrIp: 0.0.0.0/0
173
+ Description: Allow all outbound traffic by default
174
+ IpProtocol: '-1'
175
+ SecurityGroupIngress:
176
+ - CidrIp: 0.0.0.0/0
177
+ Description: Allow traffic from anywhere to Restate ingress port
178
+ FromPort: 443
179
+ IpProtocol: tcp
180
+ ToPort: 443
181
+ - CidrIp: 0.0.0.0/0
182
+ Description: Allow traffic from anywhere to Restate admin port
183
+ FromPort: 9073
184
+ IpProtocol: tcp
185
+ ToPort: 9073
186
+ VpcId: vpc-12345
187
+ Parameters: Any<Object>
188
+ "
189
+ `;
190
+
191
+ exports[`Restate constructs Create a self-hosted Restate environment deployed on ECS Fargate 1`] = `
192
+ "Resources:
193
+ ZoneA5DE4B68:
194
+ Type: 'AWS::Route53::HostedZone'
195
+ Properties:
196
+ Name: example.com.
197
+ RestateDataStore0EBA6BBD:
198
+ Type: 'AWS::EFS::FileSystem'
199
+ Properties:
200
+ Encrypted: true
201
+ FileSystemPolicy:
202
+ Statement:
203
+ - Action: 'elasticfilesystem:ClientMount'
204
+ Condition:
205
+ Bool:
206
+ 'elasticfilesystem:AccessedViaMountTarget': 'true'
207
+ Effect: Allow
208
+ Principal:
209
+ AWS: '*'
210
+ Sid: AllowEfsMount
211
+ - Action:
212
+ - 'elasticfilesystem:ClientWrite'
213
+ - 'elasticfilesystem:ClientRootAccess'
214
+ Condition:
215
+ Bool:
216
+ 'elasticfilesystem:AccessedViaMountTarget': 'true'
217
+ Effect: Allow
218
+ Principal:
219
+ AWS: '*'
220
+ Version: '2012-10-17'
221
+ FileSystemTags:
222
+ - Key: Name
223
+ Value: RestateOnFargateStack/Restate/DataStore
224
+ LifecyclePolicies:
225
+ - TransitionToIA: AFTER_30_DAYS
226
+ PerformanceMode: generalPurpose
227
+ ThroughputMode: bursting
228
+ UpdateReplacePolicy: Delete
229
+ DeletionPolicy: Delete
230
+ RestateDataStoreEfsSecurityGroup9E142FDF:
231
+ Type: 'AWS::EC2::SecurityGroup'
232
+ Properties:
233
+ GroupDescription: RestateOnFargateStack/Restate/DataStore/EfsSecurityGroup
234
+ SecurityGroupEgress:
235
+ - CidrIp: 0.0.0.0/0
236
+ Description: Allow all outbound traffic by default
237
+ IpProtocol: '-1'
238
+ Tags:
239
+ - Key: Name
240
+ Value: RestateOnFargateStack/Restate/DataStore
241
+ VpcId: vpc-12345
242
+ RestateDataStoreEfsSecurityGroupfromRestateOnFargateStackRestateSecurityGroup716176472049806B116B:
243
+ Type: 'AWS::EC2::SecurityGroupIngress'
244
+ Properties:
245
+ Description: 'from RestateOnFargateStackRestateSecurityGroup71617647:2049'
246
+ FromPort: 2049
247
+ GroupId:
248
+ 'Fn::GetAtt':
249
+ - RestateDataStoreEfsSecurityGroup9E142FDF
250
+ - GroupId
251
+ IpProtocol: tcp
252
+ SourceSecurityGroupId:
253
+ 'Fn::GetAtt':
254
+ - RestateSecurityGroup51491232
255
+ - GroupId
256
+ ToPort: 2049
257
+ RestateDataStoreEfsMountTarget1FE8B299E:
258
+ Type: 'AWS::EFS::MountTarget'
259
+ Properties:
260
+ FileSystemId:
261
+ Ref: RestateDataStore0EBA6BBD
262
+ SecurityGroups:
263
+ - 'Fn::GetAtt':
264
+ - RestateDataStoreEfsSecurityGroup9E142FDF
265
+ - GroupId
266
+ SubnetId: p-12345
267
+ RestateDataStoreEfsMountTarget21C454C30:
268
+ Type: 'AWS::EFS::MountTarget'
269
+ Properties:
270
+ FileSystemId:
271
+ Ref: RestateDataStore0EBA6BBD
272
+ SecurityGroups:
273
+ - 'Fn::GetAtt':
274
+ - RestateDataStoreEfsSecurityGroup9E142FDF
275
+ - GroupId
276
+ SubnetId: p-67890
277
+ RestateCluster26F7C702:
278
+ Type: 'AWS::ECS::Cluster'
279
+ RestateRestateTaskTaskRole3425804E:
280
+ Type: 'AWS::IAM::Role'
281
+ Properties:
282
+ AssumeRolePolicyDocument:
283
+ Statement:
284
+ - Action: 'sts:AssumeRole'
285
+ Effect: Allow
286
+ Principal:
287
+ Service: ecs-tasks.amazonaws.com
288
+ Version: '2012-10-17'
289
+ RestateRestateTaskTaskRoleDefaultPolicyD6897EE5:
290
+ Type: 'AWS::IAM::Policy'
291
+ Properties:
292
+ PolicyDocument:
293
+ Statement:
294
+ - Action: 'sts:AssumeRole'
295
+ Effect: Allow
296
+ Resource:
297
+ 'Fn::GetAtt':
298
+ - RestateInvokerRole42565598
299
+ - Arn
300
+ - Action:
301
+ - 'elasticfilesystem:ClientMount'
302
+ - 'elasticfilesystem:ClientWrite'
303
+ - 'elasticfilesystem:ClientRootAccess'
304
+ Condition:
305
+ Bool:
306
+ 'elasticfilesystem:AccessedViaMountTarget': 'true'
307
+ Effect: Allow
308
+ Resource:
309
+ 'Fn::GetAtt':
310
+ - RestateDataStore0EBA6BBD
311
+ - Arn
312
+ Version: '2012-10-17'
313
+ PolicyName: RestateRestateTaskTaskRoleDefaultPolicyD6897EE5
314
+ Roles:
315
+ - Ref: RestateRestateTaskTaskRole3425804E
316
+ RestateRestateTask73B141AE:
317
+ Type: 'AWS::ECS::TaskDefinition'
318
+ Properties:
319
+ ContainerDefinitions:
320
+ - Environment:
321
+ - Name: RESTATE_OBSERVABILITY__LOG__FORMAT
322
+ Value: Json
323
+ Essential: true
324
+ Image: 'docker.io/restatedev/restate:latest'
325
+ LogConfiguration:
326
+ LogDriver: awslogs
327
+ Options:
328
+ awslogs-group:
329
+ Ref: RestateLogsFD86ECAE
330
+ awslogs-stream-prefix: restate
331
+ awslogs-region: region
332
+ MountPoints:
333
+ - ContainerPath: /target
334
+ ReadOnly: false
335
+ SourceVolume: restateStore
336
+ Name: restate-runtime
337
+ PortMappings:
338
+ - ContainerPort: 8080
339
+ Protocol: tcp
340
+ - ContainerPort: 9070
341
+ Protocol: tcp
342
+ StartTimeout: 20
343
+ StopTimeout: 20
344
+ Cpu: '4096'
345
+ ExecutionRoleArn:
346
+ 'Fn::GetAtt':
347
+ - RestateRestateTaskExecutionRole8ED5B0F9
348
+ - Arn
349
+ Family: RestateOnFargateStackRestateRestateTaskD92D0B67
350
+ Memory: '8192'
351
+ NetworkMode: awsvpc
352
+ RequiresCompatibilities:
353
+ - FARGATE
354
+ RuntimePlatform:
355
+ CpuArchitecture: ARM64
356
+ OperatingSystemFamily: LINUX
357
+ TaskRoleArn:
358
+ 'Fn::GetAtt':
359
+ - RestateRestateTaskTaskRole3425804E
360
+ - Arn
361
+ Volumes:
362
+ - EFSVolumeConfiguration:
363
+ AuthorizationConfig: {}
364
+ FilesystemId:
365
+ Ref: RestateDataStore0EBA6BBD
366
+ Name: restateStore
367
+ RestateRestateTaskExecutionRole8ED5B0F9:
368
+ Type: 'AWS::IAM::Role'
369
+ Properties:
370
+ AssumeRolePolicyDocument:
371
+ Statement:
372
+ - Action: 'sts:AssumeRole'
373
+ Effect: Allow
374
+ Principal:
375
+ Service: ecs-tasks.amazonaws.com
376
+ Version: '2012-10-17'
377
+ RestateRestateTaskExecutionRoleDefaultPolicy8E1BA931:
378
+ Type: 'AWS::IAM::Policy'
379
+ Properties:
380
+ PolicyDocument:
381
+ Statement:
382
+ - Action:
383
+ - 'logs:CreateLogStream'
384
+ - 'logs:PutLogEvents'
385
+ Effect: Allow
386
+ Resource:
387
+ 'Fn::GetAtt':
388
+ - RestateLogsFD86ECAE
389
+ - Arn
390
+ Version: '2012-10-17'
391
+ PolicyName: RestateRestateTaskExecutionRoleDefaultPolicy8E1BA931
392
+ Roles:
393
+ - Ref: RestateRestateTaskExecutionRole8ED5B0F9
394
+ RestateTaskPolicy1A15994E:
395
+ Type: 'AWS::IAM::Policy'
396
+ Properties:
397
+ PolicyDocument:
398
+ Statement:
399
+ - Action: 'sts:AssumeRole'
400
+ Effect: Allow
401
+ Resource: '*'
402
+ Sid: AllowAssumeAnyRole
403
+ Version: '2012-10-17'
404
+ PolicyName: RestateTaskPolicy1A15994E
405
+ Roles:
406
+ - Ref: RestateRestateTaskTaskRole3425804E
407
+ RestateInvokerRole42565598:
408
+ Type: 'AWS::IAM::Role'
409
+ Properties:
410
+ AssumeRolePolicyDocument:
411
+ Statement:
412
+ - Action: 'sts:AssumeRole'
413
+ Effect: Allow
414
+ Principal:
415
+ AWS:
416
+ 'Fn::GetAtt':
417
+ - RestateRestateTaskTaskRole3425804E
418
+ - Arn
419
+ Version: '2012-10-17'
420
+ Description: Assumed by Restate deployment to invoke Lambda-based services
421
+ RestateLogsFD86ECAE:
422
+ Type: 'AWS::Logs::LogGroup'
423
+ Properties:
424
+ LogGroupName: /restate/Restate
425
+ RetentionInDays: 30
426
+ UpdateReplacePolicy: Delete
427
+ DeletionPolicy: Delete
428
+ RestateSecurityGroup51491232:
429
+ Type: 'AWS::EC2::SecurityGroup'
430
+ Properties:
431
+ GroupDescription: RestateOnFargateStack/Restate/SecurityGroup
432
+ SecurityGroupEgress:
433
+ - CidrIp: 0.0.0.0/0
434
+ Description: Allow all outbound traffic by default
435
+ IpProtocol: '-1'
436
+ VpcId: vpc-12345
437
+ RestateSecurityGroupfromRestateOnFargateStackRestateDataStoreEfsSecurityGroupD91B15E020498B6DB4D2:
438
+ Type: 'AWS::EC2::SecurityGroupIngress'
439
+ Properties:
440
+ Description: 'from RestateOnFargateStackRestateDataStoreEfsSecurityGroupD91B15E0:2049'
441
+ FromPort: 2049
442
+ GroupId:
443
+ 'Fn::GetAtt':
444
+ - RestateSecurityGroup51491232
445
+ - GroupId
446
+ IpProtocol: tcp
447
+ SourceSecurityGroupId:
448
+ 'Fn::GetAtt':
449
+ - RestateDataStoreEfsSecurityGroup9E142FDF
450
+ - GroupId
451
+ ToPort: 2049
452
+ RestateSecurityGroupfromRestateOnFargateStackRestateAlbSecurityGroup0956EE2980803FA00CFA:
453
+ Type: 'AWS::EC2::SecurityGroupIngress'
454
+ Properties:
455
+ Description: Load balancer to target
456
+ FromPort: 8080
457
+ GroupId:
458
+ 'Fn::GetAtt':
459
+ - RestateSecurityGroup51491232
460
+ - GroupId
461
+ IpProtocol: tcp
462
+ SourceSecurityGroupId:
463
+ 'Fn::GetAtt':
464
+ - RestateAlbSecurityGroupFAAA5CAC
465
+ - GroupId
466
+ ToPort: 8080
467
+ RestateSecurityGroupfromRestateOnFargateStackRestateAlbSecurityGroup0956EE299070AC228309:
468
+ Type: 'AWS::EC2::SecurityGroupIngress'
469
+ Properties:
470
+ Description: Load balancer to target
471
+ FromPort: 9070
472
+ GroupId:
473
+ 'Fn::GetAtt':
474
+ - RestateSecurityGroup51491232
475
+ - GroupId
476
+ IpProtocol: tcp
477
+ SourceSecurityGroupId:
478
+ 'Fn::GetAtt':
479
+ - RestateAlbSecurityGroupFAAA5CAC
480
+ - GroupId
481
+ ToPort: 9070
482
+ RestateService6A740A49:
483
+ Type: 'AWS::ECS::Service'
484
+ Properties:
485
+ Cluster:
486
+ Ref: RestateCluster26F7C702
487
+ DeploymentConfiguration:
488
+ Alarms:
489
+ AlarmNames: []
490
+ Enable: false
491
+ Rollback: false
492
+ DeploymentCircuitBreaker:
493
+ Enable: true
494
+ Rollback: true
495
+ MaximumPercent: 100
496
+ MinimumHealthyPercent: 0
497
+ DeploymentController:
498
+ Type: ECS
499
+ EnableECSManagedTags: false
500
+ HealthCheckGracePeriodSeconds: 60
501
+ LaunchType: FARGATE
502
+ LoadBalancers:
503
+ - ContainerName: restate-runtime
504
+ ContainerPort: 8080
505
+ TargetGroupArn:
506
+ Ref: RestateAlbIngressListenerFargateIngressTargetGroupF8DA5188
507
+ - ContainerName: restate-runtime
508
+ ContainerPort: 9070
509
+ TargetGroupArn:
510
+ Ref: RestateAlbAdminListenerFargateAdminTargetGroupB830BB5A
511
+ NetworkConfiguration:
512
+ AwsvpcConfiguration:
513
+ AssignPublicIp: ENABLED
514
+ SecurityGroups:
515
+ - 'Fn::GetAtt':
516
+ - RestateSecurityGroup51491232
517
+ - GroupId
518
+ Subnets:
519
+ - s-12345
520
+ - s-67890
521
+ TaskDefinition:
522
+ Ref: RestateRestateTask73B141AE
523
+ DependsOn:
524
+ - RestateAlbAdminListenerFargateAdminTargetGroupB830BB5A
525
+ - RestateAlbAdminListenerDEA13626
526
+ - RestateAlbIngressListenerFargateIngressTargetGroupF8DA5188
527
+ - RestateAlbIngressListener7C1FE52C
528
+ - RestateRestateTaskTaskRoleDefaultPolicyD6897EE5
529
+ - RestateRestateTaskTaskRole3425804E
530
+ RestateAlbDE422F47:
531
+ Type: 'AWS::ElasticLoadBalancingV2::LoadBalancer'
532
+ Properties:
533
+ LoadBalancerAttributes:
534
+ - Key: deletion_protection.enabled
535
+ Value: 'false'
536
+ Scheme: internal
537
+ SecurityGroups:
538
+ - 'Fn::GetAtt':
539
+ - RestateAlbSecurityGroupFAAA5CAC
540
+ - GroupId
541
+ Subnets:
542
+ - p-12345
543
+ - p-67890
544
+ Type: application
545
+ RestateAlbSecurityGroupFAAA5CAC:
546
+ Type: 'AWS::EC2::SecurityGroup'
547
+ Properties:
548
+ GroupDescription: >-
549
+ Automatically created Security Group for ELB
550
+ RestateOnFargateStackRestateAlb82A45EC3
551
+ SecurityGroupIngress:
552
+ - CidrIp: 0.0.0.0/0
553
+ Description: Allow from anyone on port 443
554
+ FromPort: 443
555
+ IpProtocol: tcp
556
+ ToPort: 443
557
+ - CidrIp: 0.0.0.0/0
558
+ Description: Allow from anyone on port 9070
559
+ FromPort: 9070
560
+ IpProtocol: tcp
561
+ ToPort: 9070
562
+ VpcId: vpc-12345
563
+ RestateAlbSecurityGrouptoRestateOnFargateStackRestateSecurityGroup7161764780809AF9E3CE:
564
+ Type: 'AWS::EC2::SecurityGroupEgress'
565
+ Properties:
566
+ Description: Load balancer to target
567
+ DestinationSecurityGroupId:
568
+ 'Fn::GetAtt':
569
+ - RestateSecurityGroup51491232
570
+ - GroupId
571
+ FromPort: 8080
572
+ GroupId:
573
+ 'Fn::GetAtt':
574
+ - RestateAlbSecurityGroupFAAA5CAC
575
+ - GroupId
576
+ IpProtocol: tcp
577
+ ToPort: 8080
578
+ RestateAlbSecurityGrouptoRestateOnFargateStackRestateSecurityGroup716176479070A56BC36B:
579
+ Type: 'AWS::EC2::SecurityGroupEgress'
580
+ Properties:
581
+ Description: Load balancer to target
582
+ DestinationSecurityGroupId:
583
+ 'Fn::GetAtt':
584
+ - RestateSecurityGroup51491232
585
+ - GroupId
586
+ FromPort: 9070
587
+ GroupId:
588
+ 'Fn::GetAtt':
589
+ - RestateAlbSecurityGroupFAAA5CAC
590
+ - GroupId
591
+ IpProtocol: tcp
592
+ ToPort: 9070
593
+ RestateAlbIngressListener7C1FE52C:
594
+ Type: 'AWS::ElasticLoadBalancingV2::Listener'
595
+ Properties:
596
+ Certificates:
597
+ - CertificateArn:
598
+ Ref: RestateCertificateD6532EB8
599
+ DefaultActions:
600
+ - TargetGroupArn:
601
+ Ref: RestateAlbIngressListenerFargateIngressTargetGroupF8DA5188
602
+ Type: forward
603
+ LoadBalancerArn:
604
+ Ref: RestateAlbDE422F47
605
+ Port: 443
606
+ Protocol: HTTPS
607
+ RestateAlbIngressListenerFargateIngressTargetGroupF8DA5188:
608
+ Type: 'AWS::ElasticLoadBalancingV2::TargetGroup'
609
+ Properties:
610
+ HealthCheckIntervalSeconds: 5
611
+ HealthCheckPath: /grpc.health.v1.Health/Check
612
+ HealthCheckTimeoutSeconds: 2
613
+ HealthyThresholdCount: 3
614
+ Port: 80
615
+ Protocol: HTTP
616
+ TargetGroupAttributes:
617
+ - Key: deregistration_delay.timeout_seconds
618
+ Value: '5'
619
+ - Key: stickiness.enabled
620
+ Value: 'false'
621
+ TargetType: ip
622
+ UnhealthyThresholdCount: 3
623
+ VpcId: vpc-12345
624
+ RestateAlbAdminListenerDEA13626:
625
+ Type: 'AWS::ElasticLoadBalancingV2::Listener'
626
+ Properties:
627
+ Certificates:
628
+ - CertificateArn:
629
+ Ref: RestateCertificateD6532EB8
630
+ DefaultActions:
631
+ - TargetGroupArn:
632
+ Ref: RestateAlbAdminListenerFargateAdminTargetGroupB830BB5A
633
+ Type: forward
634
+ LoadBalancerArn:
635
+ Ref: RestateAlbDE422F47
636
+ Port: 9070
637
+ Protocol: HTTPS
638
+ RestateAlbAdminListenerFargateAdminTargetGroupB830BB5A:
639
+ Type: 'AWS::ElasticLoadBalancingV2::TargetGroup'
640
+ Properties:
641
+ HealthCheckIntervalSeconds: 5
642
+ HealthCheckPath: /health
643
+ HealthCheckTimeoutSeconds: 2
644
+ HealthyThresholdCount: 3
645
+ Port: 80
646
+ Protocol: HTTP
647
+ TargetGroupAttributes:
648
+ - Key: deregistration_delay.timeout_seconds
649
+ Value: '5'
650
+ - Key: stickiness.enabled
651
+ Value: 'false'
652
+ TargetType: ip
653
+ UnhealthyThresholdCount: 3
654
+ VpcId: vpc-12345
655
+ RestateCertificateD6532EB8:
656
+ Type: 'AWS::CertificateManager::Certificate'
657
+ Properties:
658
+ DomainName: restate.example.com
659
+ DomainValidationOptions:
660
+ - DomainName: restate.example.com
661
+ HostedZoneId:
662
+ Ref: ZoneA5DE4B68
663
+ Tags:
664
+ - Key: Name
665
+ Value: RestateOnFargateStack/Restate/Certificate
666
+ ValidationMethod: DNS
667
+ RestateAlbAliasA12130FD:
668
+ Type: 'AWS::Route53::RecordSet'
669
+ Properties:
670
+ AliasTarget:
671
+ DNSName:
672
+ 'Fn::Join':
673
+ - ''
674
+ - - dualstack.
675
+ - 'Fn::GetAtt':
676
+ - RestateAlbDE422F47
677
+ - DNSName
678
+ HostedZoneId:
679
+ 'Fn::GetAtt':
680
+ - RestateAlbDE422F47
681
+ - CanonicalHostedZoneID
682
+ HostedZoneId:
683
+ Ref: ZoneA5DE4B68
684
+ Name: restate.example.com.
685
+ Type: A
686
+ "
687
+ `;
688
+
689
+ exports[`Restate constructs Deploy a Lambda service handler to a remote Restate environment 1`] = `
690
+ "Resources:
691
+ InvokerRole4DB2757E:
692
+ Type: 'AWS::IAM::Role'
693
+ Properties:
694
+ AssumeRolePolicyDocument:
695
+ Statement:
696
+ - Action: 'sts:AssumeRole'
697
+ Effect: Allow
698
+ Principal:
699
+ AWS:
700
+ 'Fn::Join':
701
+ - ''
702
+ - - 'arn:'
703
+ - Ref: 'AWS::Partition'
704
+ - ':iam::'
705
+ - Ref: 'AWS::AccountId'
706
+ - ':root'
707
+ Version: '2012-10-17'
708
+ InvokerRoleDefaultPolicy713FD858:
709
+ Type: 'AWS::IAM::Policy'
710
+ Properties:
711
+ PolicyDocument:
712
+ Statement:
713
+ - Action: 'lambda:InvokeFunction'
714
+ Effect: Allow
715
+ Resource:
716
+ - 'Fn::GetAtt':
717
+ - RestateServiceHandler71409CD7
718
+ - Arn
719
+ - 'Fn::Join':
720
+ - ''
721
+ - - 'Fn::GetAtt':
722
+ - RestateServiceHandler71409CD7
723
+ - Arn
724
+ - ':*'
725
+ Version: '2012-10-17'
726
+ PolicyName: InvokerRoleDefaultPolicy713FD858
727
+ Roles:
728
+ - Ref: InvokerRole4DB2757E
729
+ RestateApiKey6463672F:
730
+ Type: 'AWS::SecretsManager::Secret'
731
+ Properties:
732
+ SecretString: api-key
733
+ UpdateReplacePolicy: Delete
734
+ DeletionPolicy: Delete
735
+ RestateServiceHandlerServiceRole07B26D05:
736
+ Type: 'AWS::IAM::Role'
737
+ Properties:
738
+ AssumeRolePolicyDocument:
739
+ Statement:
740
+ - Action: 'sts:AssumeRole'
741
+ Effect: Allow
742
+ Principal:
743
+ Service: lambda.amazonaws.com
744
+ Version: '2012-10-17'
745
+ ManagedPolicyArns:
746
+ - 'Fn::Join':
747
+ - ''
748
+ - - 'arn:'
749
+ - Ref: 'AWS::Partition'
750
+ - ':iam::aws:policy/service-role/AWSLambdaBasicExecutionRole'
751
+ RestateServiceHandler71409CD7:
752
+ Type: 'AWS::Lambda::Function'
753
+ Properties:
754
+ Code: Any<Object>
755
+ Handler: index.handler
756
+ Role:
757
+ 'Fn::GetAtt':
758
+ - RestateServiceHandlerServiceRole07B26D05
759
+ - Arn
760
+ Runtime: nodejs18.x
761
+ DependsOn:
762
+ - RestateServiceHandlerServiceRole07B26D05
763
+ RestateServiceHandlerCurrentVersion40030E671fc2ba09c2d7b4ea8c6a3f8fee895a65:
764
+ Type: 'AWS::Lambda::Version'
765
+ Properties:
766
+ FunctionName:
767
+ Ref: RestateServiceHandler71409CD7
768
+ RestateServiceHandlerCurrentVersionRestateDeploymentE8F102EB:
769
+ Type: 'Custom::RestateServiceDeployment'
770
+ Properties:
771
+ ServiceToken:
772
+ 'Fn::GetAtt':
773
+ - ServiceDeployerCustomResourceProviderframeworkonEvent528FE6C2
774
+ - Arn
775
+ servicePath: Service
776
+ adminUrl: 'https://restate.example.com:9070'
777
+ authTokenSecretArn:
778
+ Ref: RestateApiKey6463672F
779
+ serviceLambdaArn:
780
+ Ref: >-
781
+ RestateServiceHandlerCurrentVersion40030E671fc2ba09c2d7b4ea8c6a3f8fee895a65
782
+ invokeRoleArn:
783
+ 'Fn::GetAtt':
784
+ - InvokerRole4DB2757E
785
+ - Arn
786
+ removalPolicy: retain
787
+ private: 'false'
788
+ insecure: 'false'
789
+ DependsOn:
790
+ - ServiceDeployerInvocationPolicyD09B639D
791
+ UpdateReplacePolicy: Delete
792
+ DeletionPolicy: Delete
793
+ ServiceDeployerEventHandlerServiceRoleF133584F:
794
+ Type: 'AWS::IAM::Role'
795
+ Properties:
796
+ AssumeRolePolicyDocument:
797
+ Statement:
798
+ - Action: 'sts:AssumeRole'
799
+ Effect: Allow
800
+ Principal:
801
+ Service: lambda.amazonaws.com
802
+ Version: '2012-10-17'
803
+ ManagedPolicyArns:
804
+ - 'Fn::Join':
805
+ - ''
806
+ - - 'arn:'
807
+ - Ref: 'AWS::Partition'
808
+ - ':iam::aws:policy/service-role/AWSLambdaBasicExecutionRole'
809
+ ServiceDeployerEventHandlerServiceRoleDefaultPolicyFE2DC3C9:
810
+ Type: 'AWS::IAM::Policy'
811
+ Properties:
812
+ PolicyDocument:
813
+ Statement:
814
+ - Action:
815
+ - 'secretsmanager:GetSecretValue'
816
+ - 'secretsmanager:DescribeSecret'
817
+ Effect: Allow
818
+ Resource:
819
+ Ref: RestateApiKey6463672F
820
+ Version: '2012-10-17'
821
+ PolicyName: ServiceDeployerEventHandlerServiceRoleDefaultPolicyFE2DC3C9
822
+ Roles:
823
+ - Ref: ServiceDeployerEventHandlerServiceRoleF133584F
824
+ ServiceDeployerEventHandler89EAD25F:
825
+ Type: 'AWS::Lambda::Function'
826
+ Properties:
827
+ Architectures:
828
+ - arm64
829
+ Code: Any<Object>
830
+ Description: Restate custom registration handler
831
+ Environment:
832
+ Variables:
833
+ NODE_OPTIONS: '--enable-source-maps'
834
+ AWS_NODEJS_CONNECTION_REUSE_ENABLED: '1'
835
+ Handler: index.handler
836
+ MemorySize: 128
837
+ Role:
838
+ 'Fn::GetAtt':
839
+ - ServiceDeployerEventHandlerServiceRoleF133584F
840
+ - Arn
841
+ Runtime: nodejs18.x
842
+ Timeout: 180
843
+ DependsOn:
844
+ - ServiceDeployerEventHandlerServiceRoleDefaultPolicyFE2DC3C9
845
+ - ServiceDeployerEventHandlerServiceRoleF133584F
846
+ ServiceDeployerCustomResourceProviderframeworkonEventServiceRole865AFB0C:
847
+ Type: 'AWS::IAM::Role'
848
+ Properties:
849
+ AssumeRolePolicyDocument:
850
+ Statement:
851
+ - Action: 'sts:AssumeRole'
852
+ Effect: Allow
853
+ Principal:
854
+ Service: lambda.amazonaws.com
855
+ Version: '2012-10-17'
856
+ ManagedPolicyArns:
857
+ - 'Fn::Join':
858
+ - ''
859
+ - - 'arn:'
860
+ - Ref: 'AWS::Partition'
861
+ - ':iam::aws:policy/service-role/AWSLambdaBasicExecutionRole'
862
+ ServiceDeployerCustomResourceProviderframeworkonEventServiceRoleDefaultPolicy740A65C9:
863
+ Type: 'AWS::IAM::Policy'
864
+ Properties:
865
+ PolicyDocument:
866
+ Statement:
867
+ - Action: 'lambda:InvokeFunction'
868
+ Effect: Allow
869
+ Resource:
870
+ - 'Fn::GetAtt':
871
+ - ServiceDeployerEventHandler89EAD25F
872
+ - Arn
873
+ - 'Fn::Join':
874
+ - ''
875
+ - - 'Fn::GetAtt':
876
+ - ServiceDeployerEventHandler89EAD25F
877
+ - Arn
878
+ - ':*'
879
+ Version: '2012-10-17'
880
+ PolicyName: >-
881
+ ServiceDeployerCustomResourceProviderframeworkonEventServiceRoleDefaultPolicy740A65C9
882
+ Roles:
883
+ - Ref: >-
884
+ ServiceDeployerCustomResourceProviderframeworkonEventServiceRole865AFB0C
885
+ ServiceDeployerCustomResourceProviderframeworkonEvent528FE6C2:
886
+ Type: 'AWS::Lambda::Function'
887
+ Properties:
888
+ Code: Any<Object>
889
+ Description: >-
890
+ AWS CDK resource provider framework - onEvent
891
+ (LambdaServiceDeployment/ServiceDeployer/CustomResourceProvider)
892
+ Environment:
893
+ Variables:
894
+ USER_ON_EVENT_FUNCTION_ARN:
895
+ 'Fn::GetAtt':
896
+ - ServiceDeployerEventHandler89EAD25F
897
+ - Arn
898
+ Handler: framework.onEvent
899
+ Role:
900
+ 'Fn::GetAtt':
901
+ - >-
902
+ ServiceDeployerCustomResourceProviderframeworkonEventServiceRole865AFB0C
903
+ - Arn
904
+ Runtime: nodejs18.x
905
+ Timeout: 900
906
+ DependsOn:
907
+ - >-
908
+ ServiceDeployerCustomResourceProviderframeworkonEventServiceRoleDefaultPolicy740A65C9
909
+ - ServiceDeployerCustomResourceProviderframeworkonEventServiceRole865AFB0C
910
+ ServiceDeployerInvocationPolicyD09B639D:
911
+ Type: 'AWS::IAM::Policy'
912
+ Properties:
913
+ PolicyDocument:
914
+ Statement:
915
+ - Action: 'lambda:InvokeFunction'
916
+ Effect: Allow
917
+ Resource:
918
+ - 'Fn::GetAtt':
919
+ - RestateServiceHandler71409CD7
920
+ - Arn
921
+ - 'Fn::Join':
922
+ - ''
923
+ - - 'Fn::GetAtt':
924
+ - RestateServiceHandler71409CD7
925
+ - Arn
926
+ - ':*'
927
+ Version: '2012-10-17'
928
+ PolicyName: ServiceDeployerInvocationPolicyD09B639D
929
+ Roles:
930
+ - Ref: InvokerRole4DB2757E
931
+ "
932
+ `;