@aws-cdk/aws-mediaconnect-alpha 2.263.0-alpha.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.
package/README.md ADDED
@@ -0,0 +1,1280 @@
1
+ # AWS::MediaConnect Construct Library
2
+ <!--BEGIN STABILITY BANNER-->
3
+
4
+ ---
5
+
6
+ ![cdk-constructs: Experimental](https://img.shields.io/badge/cdk--constructs-experimental-important.svg?style=for-the-badge)
7
+
8
+ > The APIs of higher level constructs in this module are experimental and under active development.
9
+ > They are subject to non-backward compatible changes or removal in any future version. These are
10
+ > not subject to the [Semantic Versioning](https://semver.org/) model and breaking changes will be
11
+ > announced in the release notes. This means that while you may use them, you may need to update
12
+ > your source code when upgrading to a newer version of this package.
13
+
14
+ ---
15
+
16
+ <!--END STABILITY BANNER-->
17
+
18
+
19
+ ## AWS Elemental MediaConnect
20
+
21
+ AWS Elemental MediaConnect is a high-quality transport service for live video. It provides the reliability and security of satellite and fiber-optic combined with the flexibility, agility, and economics of IP-based networks. MediaConnect enables you to build mission-critical live video workflows in a fraction of the time and cost of satellite or fiber services.
22
+
23
+ This package contains constructs for working with AWS Elemental MediaConnect, allowing you to define Flows, Bridges, Gateways, Router Inputs, Router Outputs, and Router Network Interfaces for transporting live video streams.
24
+
25
+ For further information on AWS Elemental MediaConnect, see [the documentation](https://aws.amazon.com/mediaconnect/).
26
+
27
+ ## Table of Contents
28
+
29
+ - [Router Resources](#router-resources)
30
+ - [Router Network Interfaces](#router-network-interfaces)
31
+ - [Router Inputs](#router-inputs)
32
+ - [Router Outputs](#router-outputs)
33
+ - [Flows](#flows)
34
+ - [Creating a Flow](#creating-a-flow)
35
+ - [Flow Sources](#flow-sources)
36
+ - [VPC Interfaces](#vpc-interfaces)
37
+ - [Media Streams](#media-streams)
38
+ - [Flow Sizes](#flow-sizes)
39
+ - [Gateways](#gateways)
40
+ - [Creating a Gateway](#creating-a-gateway)
41
+ - [Importing an Existing Gateway](#importing-an-existing-gateway)
42
+ - [Bridges](#bridges)
43
+ - [Creating a Bridge](#creating-a-bridge)
44
+ - [Bridge Sources](#bridge-sources)
45
+ - [Bridge Outputs](#bridge-outputs)
46
+ - [Encryption](#encryption)
47
+ - [CloudWatch Metrics](#cloudwatch-metrics)
48
+ - [Public CIDR warnings](#public-cidr-warnings)
49
+
50
+ ## Router Resources
51
+
52
+ MediaConnect routers provide high-performance, low-latency video routing capabilities for building complex live video workflows. Router resources include network interfaces, inputs, and outputs.
53
+
54
+ ### How Router Resources Relate
55
+
56
+ Router resources work together in a pipeline:
57
+
58
+ - A **RouterNetworkInterface** defines the network connectivity (public internet or VPC). Required for standard protocol-based inputs and outputs, but not needed when connecting to MediaLive inputs or MediaConnect flows directly.
59
+ - A **RouterInput** is the entry point — it receives video from a source via a protocol (RTP, SRT, RIST), or from a MediaConnect flow.
60
+ - A **RouterOutput** is the exit point — it sends video to a destination via a protocol, to a MediaLive input, or to a MediaConnect flow.
61
+
62
+ A typical camera-to-cloud workflow looks like:
63
+
64
+ ```text
65
+ Camera → RouterNetworkInterface → RouterInput (SRT) → [Router] → RouterOutput (MediaLive) → MediaLive Channel
66
+ ```
67
+
68
+ The router sits in the middle, routing content from inputs to outputs. You can have many outputs per input — for example, one camera feed going to both a MediaLive channel and a MediaConnect flow simultaneously.
69
+
70
+ ### End-to-End Example: SRT Source to MediaLive
71
+
72
+ Here's a complete example showing how to connect an SRT source through a router to MediaLive:
73
+
74
+ ```ts
75
+ declare const stack: Stack;
76
+ declare const mediaLiveInput: medialive.CfnInput;
77
+
78
+ // 1. A public network interface for the SRT input
79
+ const networkInterface = new RouterNetworkInterface(stack, 'NetworkInterface', {
80
+ routerNetworkInterfaceName: 'camera-network',
81
+ configuration: RouterNetworkConfiguration.publicNetwork({
82
+ cidr: ['203.0.113.0/24'],
83
+ }),
84
+ });
85
+
86
+ // 2. A router input receiving SRT from an upstream encoder
87
+ const input = new RouterInput(stack, 'Input', {
88
+ routerInputName: 'camera-input',
89
+ maximumBitrate: Bitrate.mbps(10),
90
+ routingScope: RoutingScope.REGIONAL,
91
+ tier: RouterInputTier.INPUT_20,
92
+ configuration: RouterInputConfiguration.standard({
93
+ networkInterface,
94
+ protocol: RouterInputProtocol.srtListener({
95
+ port: 9000,
96
+ minimumLatency: Duration.millis(200),
97
+ }),
98
+ }),
99
+ });
100
+
101
+ // 3. A router output delivering to MediaLive
102
+ const output = new RouterOutput(stack, 'Output', {
103
+ routerOutputName: 'medialive-output',
104
+ maximumBitrate: Bitrate.mbps(10),
105
+ routingScope: RoutingScope.REGIONAL,
106
+ tier: RouterOutputTier.OUTPUT_20,
107
+ configuration: RouterOutputConfiguration.mediaLiveInput({
108
+ mediaLiveInputArn: mediaLiveInput.attrArn,
109
+ mediaLivePipelineId: MediaLivePipeline.PIPELINE_0,
110
+ }),
111
+ });
112
+ ```
113
+
114
+ This gives you a complete pipeline: the encoder pushes SRT to the network interface, the router receives it as an input, and the router output delivers it to MediaLive. For routing rules — including how bitrate affects which outputs can receive which inputs — see the [documentation](https://docs.aws.amazon.com/mediaconnect/latest/ug/using-router-control-panel.html).
115
+
116
+ ### Router Network Interfaces
117
+
118
+ Network interfaces define the network connectivity for router inputs and outputs:
119
+
120
+ #### Public Network Interface
121
+
122
+ ```ts
123
+ declare const stack: Stack;
124
+
125
+ const publicInterface = new RouterNetworkInterface(stack, 'PublicInterface', {
126
+ routerNetworkInterfaceName: 'public-interface',
127
+ configuration: RouterNetworkConfiguration.publicNetwork({
128
+ cidr: ['203.0.113.0/24'],
129
+ }),
130
+ });
131
+ ```
132
+
133
+ #### Private Network Interface
134
+
135
+ ```ts
136
+ declare const stack: Stack;
137
+ declare const securityGroup: ec2.ISecurityGroup;
138
+ declare const subnet: ec2.ISubnet;
139
+
140
+ const privateInterface = new RouterNetworkInterface(stack, 'PrivateInterface', {
141
+ routerNetworkInterfaceName: 'private-interface',
142
+ configuration: RouterNetworkConfiguration.vpc({
143
+ securityGroups: [securityGroup],
144
+ subnet: subnet,
145
+ }),
146
+ });
147
+ ```
148
+
149
+ ### Router Inputs
150
+
151
+ Router inputs receive live video streams from various sources and make them available for routing:
152
+
153
+ #### Standard Input with RTP Protocol
154
+
155
+ ```ts
156
+ declare const stack: Stack;
157
+ declare const networkInterface: RouterNetworkInterface;
158
+
159
+ const input = new RouterInput(stack, 'RtpInput', {
160
+ routerInputName: 'rtp-input',
161
+ maximumBitrate: Bitrate.mbps(10),
162
+ routingScope: RoutingScope.REGIONAL,
163
+ // tier defaults to RouterInputTier.INPUT_20 (lowest cost)
164
+ configuration: RouterInputConfiguration.standard({
165
+ networkInterface: networkInterface,
166
+ protocol: RouterInputProtocol.rtp({
167
+ port: 5000,
168
+ }),
169
+ }),
170
+ });
171
+ ```
172
+
173
+ #### Failover Input Configuration
174
+
175
+ ```ts
176
+ declare const stack: Stack;
177
+ declare const networkInterface: RouterNetworkInterface;
178
+
179
+ const input = new RouterInput(stack, 'FailoverInput', {
180
+ routerInputName: 'failover-input',
181
+ maximumBitrate: Bitrate.mbps(10),
182
+ routingScope: RoutingScope.REGIONAL,
183
+ tier: RouterInputTier.INPUT_50,
184
+ configuration: RouterInputConfiguration.failover({
185
+ networkInterface: networkInterface,
186
+ protocols: [
187
+ RouterInputProtocol.rist({
188
+ port: 5000,
189
+ recoveryLatency: Duration.millis(1000),
190
+ }),
191
+ RouterInputProtocol.rist({
192
+ port: 5002, // Must not be consecutive with primary port
193
+ recoveryLatency: Duration.millis(1000),
194
+ }),
195
+ ],
196
+ sourcePriority: SourcePriorityConfig.primarySecondary(PrimarySource.FIRST_SOURCE),
197
+ }),
198
+ });
199
+ ```
200
+
201
+ #### MediaConnect Flow Input
202
+
203
+ Connect a router input to an existing MediaConnect flow:
204
+
205
+ ```ts
206
+ declare const stack: Stack;
207
+ declare const flow: Flow;
208
+ declare const flowOutput: FlowOutput;
209
+
210
+ const input = new RouterInput(stack, 'FlowInput', {
211
+ routerInputName: 'flow-input',
212
+ maximumBitrate: Bitrate.mbps(20),
213
+ routingScope: RoutingScope.REGIONAL,
214
+ tier: RouterInputTier.INPUT_50,
215
+ configuration: RouterInputConfiguration.mediaConnectFlow({
216
+ flow: flow,
217
+ flowOutput: flowOutput,
218
+ }),
219
+ });
220
+ ```
221
+
222
+ Or prepare a router input for a flow connection without specifying the flow (requires explicit availability zone):
223
+
224
+ ```ts
225
+ declare const stack: Stack;
226
+
227
+ const input = new RouterInput(stack, 'FlowInputNoConnection', {
228
+ routerInputName: 'flow-input-no-connection',
229
+ maximumBitrate: Bitrate.mbps(20),
230
+ routingScope: RoutingScope.REGIONAL,
231
+ tier: RouterInputTier.INPUT_50,
232
+ configuration: RouterInputConfiguration.mediaConnectFlowWithoutConnection({
233
+ availabilityZone: 'us-east-1a',
234
+ }),
235
+ });
236
+ ```
237
+
238
+ ### Router Outputs
239
+
240
+ Router outputs send video streams to various destinations including standard protocols, MediaLive inputs, and MediaConnect flows:
241
+
242
+ #### Standard Output with SRT Protocol
243
+
244
+ ```ts
245
+ declare const stack: Stack;
246
+ declare const networkInterface: RouterNetworkInterface;
247
+
248
+ const output = new RouterOutput(stack, 'SrtOutput', {
249
+ routerOutputName: 'srt-output',
250
+ maximumBitrate: Bitrate.mbps(10),
251
+ routingScope: RoutingScope.REGIONAL,
252
+ // tier defaults to RouterOutputTier.OUTPUT_20 (lowest cost)
253
+ configuration: RouterOutputConfiguration.standard({
254
+ protocol: RouterOutputProtocol.srtListener({
255
+ port: 9001,
256
+ minimumLatency: Duration.millis(200),
257
+ }),
258
+ networkInterface: networkInterface,
259
+ }),
260
+ });
261
+ ```
262
+
263
+ > **Note:** The `tier` property defaults to the lowest (and cheapest) tier: `INPUT_20` for Router Inputs and `OUTPUT_20` for Router Outputs. The construct validates that `maximumBitrate` does not exceed the tier's capacity (20, 50, or 100 Mbps) at synth time. Per the [documentation](https://docs.aws.amazon.com/mediaconnect/latest/ug/using-router-control-panel.html), if an input is 20 Mbps you can't route it to an output set up for less than 20 Mbps.
264
+
265
+ #### MediaLive Output
266
+
267
+ Note (breaking change in the future): MediaLive configuration is currently passed in as `mediaLiveInputArn` but when L2 construct available, this will be updated to use the construct instead.
268
+
269
+ Connect a router output to an existing MediaLive input:
270
+
271
+ ```ts
272
+ declare const stack: Stack;
273
+ declare const mediaLiveInput: medialive.CfnInput;
274
+
275
+ const output = new RouterOutput(stack, 'MediaLiveOutput', {
276
+ routerOutputName: 'medialive-output',
277
+ maximumBitrate: Bitrate.mbps(15),
278
+ routingScope: RoutingScope.GLOBAL,
279
+ tier: RouterOutputTier.OUTPUT_50,
280
+ configuration: RouterOutputConfiguration.mediaLiveInput({
281
+ mediaLiveInputArn: mediaLiveInput.attrArn,
282
+ mediaLivePipelineId: MediaLivePipeline.PIPELINE_0,
283
+ }),
284
+ });
285
+ ```
286
+
287
+ Or prepare a router output for a MediaLive connection without specifying the input (requires explicit availability zone):
288
+
289
+ ```ts
290
+ declare const stack: Stack;
291
+
292
+ const output = new RouterOutput(stack, 'MediaLiveOutputNoConnection', {
293
+ routerOutputName: 'medialive-output-no-connection',
294
+ maximumBitrate: Bitrate.mbps(15),
295
+ routingScope: RoutingScope.GLOBAL,
296
+ tier: RouterOutputTier.OUTPUT_50,
297
+ configuration: RouterOutputConfiguration.mediaLiveInputWithoutConnection({
298
+ availabilityZone: 'us-east-1a',
299
+ }),
300
+ });
301
+ ```
302
+
303
+ #### MediaConnect Flow Output
304
+
305
+ Connect a router output to an existing MediaConnect flow:
306
+
307
+ ```ts
308
+ declare const stack: Stack;
309
+ declare const flow: Flow;
310
+
311
+ const output = new RouterOutput(stack, 'FlowOutput', {
312
+ routerOutputName: 'flow-output',
313
+ maximumBitrate: Bitrate.mbps(20),
314
+ routingScope: RoutingScope.REGIONAL,
315
+ tier: RouterOutputTier.OUTPUT_100,
316
+ configuration: RouterOutputConfiguration.mediaConnectFlow({
317
+ flow: flow,
318
+ }),
319
+ });
320
+ ```
321
+
322
+ Or prepare a router output for a flow connection without specifying the flow (requires explicit availability zone):
323
+
324
+ ```ts
325
+ declare const stack: Stack;
326
+
327
+ const output = new RouterOutput(stack, 'FlowOutputNoConnection', {
328
+ routerOutputName: 'flow-output-no-connection',
329
+ maximumBitrate: Bitrate.mbps(20),
330
+ routingScope: RoutingScope.REGIONAL,
331
+ tier: RouterOutputTier.OUTPUT_100,
332
+ configuration: RouterOutputConfiguration.mediaConnectFlowWithoutConnection({
333
+ availabilityZone: 'us-east-1a',
334
+ }),
335
+ });
336
+ ```
337
+
338
+ #### Output with Encryption
339
+
340
+ ```ts
341
+ declare const stack: Stack;
342
+ declare const networkInterface: RouterNetworkInterface;
343
+ declare const role: iam.IRole;
344
+ declare const secret: secretsmanager.ISecret;
345
+
346
+ const output = new RouterOutput(stack, 'EncryptedOutput', {
347
+ routerOutputName: 'encrypted-output',
348
+ maximumBitrate: Bitrate.mbps(10),
349
+ routingScope: RoutingScope.REGIONAL,
350
+ tier: RouterOutputTier.OUTPUT_50,
351
+ configuration: RouterOutputConfiguration.standard({
352
+ protocol: RouterOutputProtocol.srtCaller({
353
+ destinationAddress: '203.0.113.100',
354
+ destinationPort: 9001,
355
+ minimumLatency: Duration.millis(200),
356
+ encryptionConfiguration: { role, secret },
357
+ }),
358
+ networkInterface: networkInterface,
359
+ }),
360
+ });
361
+ ```
362
+
363
+ ## Flows
364
+
365
+ A MediaConnect flow represents a transport stream connection between a source and one or more outputs. Flows are the primary resource for transporting live video content.
366
+
367
+ ### Creating a Flow
368
+
369
+ The following example creates a basic MediaConnect flow with an RTP source:
370
+
371
+ ```ts
372
+ declare const stack: Stack;
373
+
374
+ const flow = new Flow(stack, 'MyFlow', {
375
+ flowName: 'my-live-stream',
376
+ source: SourceConfiguration.rtp({
377
+ flowSourceName: 'my-source',
378
+ port: 5000,
379
+ network: NetworkConfiguration.publicNetwork('203.0.113.0/24'),
380
+ }),
381
+ });
382
+ ```
383
+
384
+ ### Flow Sources
385
+
386
+ MediaConnect supports multiple source types for ingesting content into a flow. The examples below use `NetworkConfiguration.publicNetwork()` for simplicity, but all protocol-based sources can also use `NetworkConfiguration.vpc()` with a VPC interface for private connectivity.
387
+
388
+ > The source's `flowSourceName` and `description` are set on the `SourceConfiguration`, not on `FlowSourceProps`. This is because the same `SourceConfiguration` is used both for a flow's inline primary source (`FlowProps.source`, which has no separate props object) and for additional sources added via `FlowSource`. Keeping the name on the configuration lets both be described identically.
389
+
390
+ #### SRT Listener Source
391
+
392
+ SRT (Secure Reliable Transport) in listener mode configures MediaConnect to listen on a specific port for incoming content. The upstream device connects to MediaConnect as a caller.
393
+
394
+ ```ts
395
+ declare const stack: Stack;
396
+
397
+ const flow = new Flow(stack, 'MyFlow', {
398
+ source: SourceConfiguration.srtListener({
399
+ flowSourceName: 'live-encoder-source',
400
+ description: 'Live encoder feed',
401
+ port: 5000,
402
+ minLatency: Duration.millis(2000),
403
+ network: NetworkConfiguration.publicNetwork('203.0.113.0/24'),
404
+ }),
405
+ });
406
+ ```
407
+
408
+ #### SRT Caller Source
409
+
410
+ SRT in caller mode configures MediaConnect to connect to a remote SRT listener. Use this when the source device is listening for incoming connections rather than pushing content.
411
+
412
+ ```ts
413
+ declare const stack: Stack;
414
+
415
+ const flow = new Flow(stack, 'MyFlow', {
416
+ source: SourceConfiguration.srtCaller({
417
+ flowSourceName: 'remote-source',
418
+ sourceListenerAddress: '203.0.113.50',
419
+ sourceListenerPort: 5000,
420
+ minLatency: Duration.millis(200),
421
+ }),
422
+ });
423
+ ```
424
+
425
+ #### RTP Source
426
+
427
+ RTP (Real-time Transport Protocol) is a standard protocol for delivering audio and video over IP networks.
428
+
429
+ ```ts
430
+ declare const stack: Stack;
431
+
432
+ const flow = new Flow(stack, 'MyFlow', {
433
+ source: SourceConfiguration.rtp({
434
+ flowSourceName: 'rtp-source',
435
+ port: 5000,
436
+ network: NetworkConfiguration.publicNetwork('203.0.113.0/24'),
437
+ }),
438
+ });
439
+ ```
440
+
441
+ #### RTP-FEC Source
442
+
443
+ RTP with Forward Error Correction adds redundancy to recover lost packets without retransmission. Use this when contributing via RTP and you need packet recovery.
444
+
445
+ ```ts
446
+ declare const stack: Stack;
447
+
448
+ const flow = new Flow(stack, 'MyFlow', {
449
+ source: SourceConfiguration.rtpFec({
450
+ flowSourceName: 'rtp-fec-source',
451
+ port: 5000,
452
+ network: NetworkConfiguration.publicNetwork('203.0.113.0/24'),
453
+ }),
454
+ });
455
+ ```
456
+
457
+ #### RIST Source
458
+
459
+ RIST (Reliable Internet Stream Transport) provides reliable video transport with packet recovery.
460
+
461
+ ```ts
462
+ declare const stack: Stack;
463
+
464
+ const flow = new Flow(stack, 'MyFlow', {
465
+ source: SourceConfiguration.rist({
466
+ flowSourceName: 'rist-source',
467
+ port: 5000,
468
+ maxLatency: Duration.millis(2000),
469
+ network: NetworkConfiguration.publicNetwork('203.0.113.0/24'),
470
+ }),
471
+ });
472
+ ```
473
+
474
+ #### Zixi Push Source
475
+
476
+ Zixi Push uses the Zixi protocol for reliable video transport. Content is pushed to MediaConnect from a Zixi-compatible component upstream.
477
+
478
+ ```ts
479
+ declare const stack: Stack;
480
+
481
+ const flow = new Flow(stack, 'MyFlow', {
482
+ source: SourceConfiguration.zixiPush({
483
+ flowSourceName: 'zixi-source',
484
+ maxLatency: Duration.millis(2000),
485
+ network: NetworkConfiguration.publicNetwork('203.0.113.0/24'),
486
+ }),
487
+ });
488
+ ```
489
+
490
+ > Zixi Push ports are assigned by MediaConnect: 2088 for public sources, 2090-2099 for VPC sources. See [Source port assignments](https://docs.aws.amazon.com/mediaconnect/latest/ug/source-ports.html).
491
+
492
+ #### Router Source
493
+
494
+ Use a router source when the flow's source comes from a MediaConnect Router rather than a direct connection.
495
+
496
+ ```ts
497
+ declare const stack: Stack;
498
+
499
+ const flow = new Flow(stack, 'MyFlow', {
500
+ source: SourceConfiguration.router(),
501
+ });
502
+ ```
503
+
504
+ #### VPC Source
505
+
506
+ Use a VPC-based source when you need a connection between a flow and your Amazon VPC. This enables private connectivity for receiving content from on-premises equipment via AWS Direct Connect or VPN, or from other AWS services running in your VPC.
507
+
508
+ ```ts
509
+ declare const stack: Stack;
510
+ declare const securityGroup: ec2.ISecurityGroup;
511
+ declare const subnet: ec2.ISubnet;
512
+ declare const role: iam.IRole;
513
+
514
+ const vpcInterface = VpcInterface.define({
515
+ vpcInterfaceName: 'my-vpc-interface',
516
+ role: role,
517
+ securityGroups: [securityGroup],
518
+ subnet: subnet,
519
+ });
520
+
521
+ const flow = new Flow(stack, 'MyFlow', {
522
+ source: SourceConfiguration.rist({
523
+ flowSourceName: 'vpc-source',
524
+ description: 'VPC-based source',
525
+ port: 5000,
526
+ maxLatency: Duration.millis(2000),
527
+ network: NetworkConfiguration.vpc(vpcInterface),
528
+ }),
529
+ vpcInterfaces: [vpcInterface],
530
+ });
531
+ ```
532
+
533
+ #### Entitled Source (From Another AWS Account)
534
+
535
+ Entitlements allow you to subscribe to content from another AWS account. The entitlement is created by the content originator in their AWS account, and you import it using the entitlement ARN they provide.
536
+
537
+ ```ts
538
+ declare const stack: Stack;
539
+
540
+ // Import an entitlement from another AWS account
541
+ const entitlement = FlowEntitlement.fromFlowEntitlementArn(stack, 'ImportedEntitlement',
542
+ 'arn:aws:mediaconnect:us-west-2:111122223333:entitlement:1-11111111111111111111111111111111:MyEntitlement',
543
+ );
544
+
545
+ const flow = new Flow(stack, 'MyFlow', {
546
+ source: SourceConfiguration.entitlement({
547
+ entitlement: entitlement,
548
+ }),
549
+ });
550
+ ```
551
+
552
+ #### Gateway Bridge Source
553
+
554
+ Use a gateway bridge source when ingesting content from on-premises equipment through a MediaConnect gateway and bridge. Gateways define the network infrastructure that bridges use to transport video between on-premises and cloud environments.
555
+
556
+ ```ts
557
+ declare const stack: Stack;
558
+ declare const bridge: Bridge;
559
+ declare const role: iam.IRole;
560
+ declare const securityGroup: ec2.ISecurityGroup;
561
+ declare const subnet: ec2.ISubnet;
562
+
563
+ const vpcInterface = VpcInterface.define({
564
+ vpcInterfaceName: 'bridge-interface',
565
+ role: role,
566
+ securityGroups: [securityGroup],
567
+ subnet: subnet,
568
+ });
569
+
570
+ const flow = new Flow(stack, 'MyFlow', {
571
+ source: SourceConfiguration.gatewayBridge({
572
+ bridge: bridge,
573
+ vpcInterface: vpcInterface,
574
+ }),
575
+ vpcInterfaces: [vpcInterface],
576
+ });
577
+ ```
578
+
579
+ ### VPC Interfaces
580
+
581
+ VPC interfaces allow MediaConnect to send or receive content within your VPC. Create VPC interfaces using `VpcInterface.define()` and add them to the flow's `vpcInterfaces` array. The same interface can then be referenced in sources and outputs:
582
+
583
+ ```ts
584
+ declare const stack: Stack;
585
+ declare const role: iam.IRole;
586
+ declare const securityGroup: ec2.ISecurityGroup;
587
+ declare const subnet: ec2.ISubnet;
588
+
589
+ // Create VPC interface
590
+ const vpcInterface = VpcInterface.define({
591
+ vpcInterfaceName: 'my-vpc-interface',
592
+ role: role,
593
+ securityGroups: [securityGroup],
594
+ subnet: subnet,
595
+ networkInterfaceType: NetworkInterface.ENA,
596
+ });
597
+
598
+ // Add to flow and reference in source
599
+ const flow = new Flow(stack, 'MyFlow', {
600
+ vpcInterfaces: [vpcInterface], // Declare at flow level
601
+ source: SourceConfiguration.rist({
602
+ flowSourceName: 'vpc-source',
603
+ port: 5000,
604
+ maxLatency: Duration.millis(2000),
605
+ network: NetworkConfiguration.vpc(vpcInterface), // Reference in source
606
+ }),
607
+ });
608
+ ```
609
+
610
+ #### CDI and JPEG XS with EFA Interfaces
611
+
612
+ For high-performance CDI or JPEG XS workflows, use EFA (Elastic Fabric Adapter) interfaces. Note that flows can have a maximum of 1 EFA interface:
613
+
614
+ ```ts
615
+ declare const stack: Stack;
616
+ declare const role: iam.IRole;
617
+ declare const securityGroup: ec2.ISecurityGroup;
618
+ declare const subnet: ec2.ISubnet;
619
+
620
+ const efaInterface = VpcInterface.define({
621
+ vpcInterfaceName: 'efa-interface',
622
+ role: role,
623
+ securityGroups: [securityGroup],
624
+ subnet: subnet,
625
+ networkInterfaceType: NetworkInterface.EFA, // Required for CDI
626
+ });
627
+
628
+ const videoStream = MediaStream.video({
629
+ mediaStreamId: 1,
630
+ mediaStreamName: 'video',
631
+ videoFormat: MediaVideoFormat.HD_1080P,
632
+ fmtp: {
633
+ exactFramerate: Framerate.FPS_29_97,
634
+ par: PixelAspectRatio.SQUARE,
635
+ },
636
+ });
637
+
638
+ const flow = new Flow(stack, 'MyCdiFlow', {
639
+ flowSize: FlowSize.LARGE_4X, // Required for CDI and JPEG XS
640
+ vpcInterfaces: [efaInterface],
641
+ mediaStreams: [videoStream],
642
+ source: SourceConfiguration.cdi({
643
+ flowSourceName: 'cdi-source',
644
+ vpcInterface: efaInterface,
645
+ port: 5000,
646
+ maxSyncBuffer: 100,
647
+ mediaStreamSourceConfigurations: [{
648
+ encoding: Encoding.RAW,
649
+ mediaStream: videoStream,
650
+ }],
651
+ }),
652
+ });
653
+ ```
654
+
655
+ #### JPEG XS with Redundant Interfaces
656
+
657
+ JPEG XS requires exactly 2 input interfaces per media stream for redundancy. Typically one EFA and one ENA interface:
658
+
659
+ ```ts
660
+ declare const stack: Stack;
661
+ declare const role: iam.IRole;
662
+ declare const sg1: ec2.ISecurityGroup;
663
+ declare const sg2: ec2.ISecurityGroup;
664
+ declare const subnet: ec2.ISubnet;
665
+
666
+ const efaInterface = VpcInterface.define({
667
+ vpcInterfaceName: 'efa-interface',
668
+ role: role,
669
+ securityGroups: [sg1],
670
+ subnet: subnet,
671
+ networkInterfaceType: NetworkInterface.EFA,
672
+ });
673
+
674
+ const enaInterface = VpcInterface.define({
675
+ vpcInterfaceName: 'ena-interface',
676
+ role: role,
677
+ securityGroups: [sg2],
678
+ subnet: subnet,
679
+ networkInterfaceType: NetworkInterface.ENA,
680
+ });
681
+
682
+ const videoStream = MediaStream.video({
683
+ mediaStreamId: 1,
684
+ mediaStreamName: 'video',
685
+ videoFormat: MediaVideoFormat.UHD_2160P,
686
+ fmtp: {
687
+ exactFramerate: Framerate.FPS_59_94,
688
+ par: PixelAspectRatio.SQUARE,
689
+ colorimetry: Colorimetry.BT2020,
690
+ videoRange: VideoRange.FULL,
691
+ scanMode: ScanMode.PROGRESSIVE,
692
+ tcs: Tcs.PQ,
693
+ },
694
+ });
695
+
696
+ const flow = new Flow(stack, 'MyJpegXsFlow', {
697
+ flowSize: FlowSize.LARGE_4X, // Required for JPEG XS
698
+ vpcInterfaces: [efaInterface, enaInterface],
699
+ mediaStreams: [videoStream],
700
+ source: SourceConfiguration.jpegXs({
701
+ flowSourceName: 'jpegxs-source',
702
+ maxSyncBuffer: 100,
703
+ mediaStreamSourceConfigurations: [{
704
+ encoding: Encoding.JXSV,
705
+ port: 5000,
706
+ inputInterface: [efaInterface, enaInterface], // 2 interfaces for redundancy
707
+ mediaStream: videoStream,
708
+ }],
709
+ }),
710
+ });
711
+ ```
712
+
713
+ ### Media Streams
714
+
715
+ Media streams represent individual components of your content (video, audio, ancillary data) for ST 2110 JPEG XS or CDI workflows. Create media streams using the static factory methods and add them to the flow's `mediaStreams` array:
716
+
717
+ ```ts
718
+ declare const stack: Stack;
719
+
720
+ // Create media streams
721
+ const videoStream = MediaStream.video({
722
+ mediaStreamId: 1,
723
+ mediaStreamName: 'video-stream',
724
+ videoFormat: MediaVideoFormat.HD_1080P,
725
+ fmtp: {
726
+ colorimetry: Colorimetry.BT709,
727
+ exactFramerate: Framerate.FPS_29_97,
728
+ par: PixelAspectRatio.SQUARE,
729
+ videoRange: VideoRange.NARROW,
730
+ scanMode: ScanMode.PROGRESSIVE,
731
+ tcs: Tcs.SDR,
732
+ },
733
+ });
734
+
735
+ const audioStream = MediaStream.audio({
736
+ mediaStreamId: 2,
737
+ mediaStreamName: 'audio-stream',
738
+ channelOrder: AudioStreamOrderOptions.STANDARD_STEREO,
739
+ });
740
+
741
+ // Add to flow
742
+ const flow = new Flow(stack, 'MyFlow', {
743
+ source: SourceConfiguration.router(),
744
+ mediaStreams: [videoStream, audioStream], // Declare at flow level
745
+ });
746
+ ```
747
+
748
+ #### Audio Channel Order
749
+
750
+ For audio media streams, use the `AudioStreamOrderOptions` enum to specify the SMPTE 2110-30 channel order:
751
+
752
+ ```ts
753
+ // Available channel order options
754
+ AudioStreamOrderOptions.MONO // SMPTE2110.(M)
755
+ AudioStreamOrderOptions.DUAL_MONO // SMPTE2110.(DM)
756
+ AudioStreamOrderOptions.STANDARD_STEREO // SMPTE2110.(ST)
757
+ AudioStreamOrderOptions.LTRT_MATRIX_STEREO // SMPTE2110.(LtRt)
758
+ AudioStreamOrderOptions.SURROUND_5_1 // SMPTE2110.(51)
759
+ AudioStreamOrderOptions.SURROUND_7_1 // SMPTE2110.(71)
760
+ AudioStreamOrderOptions.SURROUND_22_2 // SMPTE2110.(222)
761
+ AudioStreamOrderOptions.ONE_SDI_AUDIO_GROUP // SMPTE2110.(SGRP)
762
+
763
+ // Example with 5.1 surround
764
+ const surroundAudio = MediaStream.audio({
765
+ mediaStreamId: 3,
766
+ mediaStreamName: 'surround-audio',
767
+ channelOrder: AudioStreamOrderOptions.SURROUND_5_1,
768
+ });
769
+ ```
770
+
771
+ Media streams can be referenced in source configurations (for CDI and JPEG XS) and output configurations.
772
+
773
+ ### Flow Sizes
774
+
775
+ MediaConnect offers three flow sizes that determine feature support:
776
+
777
+ | Flow Size | Transport Streams | NDI | CDI / JPEG XS |
778
+ |-----------|------------------|-----|---------------|
779
+ | `MEDIUM` (default) | ✅ | ❌ | ❌ |
780
+ | `LARGE` | ✅ | ✅ | ❌ |
781
+ | `LARGE_4X` | ❌ | ❌ | ✅ |
782
+
783
+ This table maps each `FlowSize` to the capabilities the construct validates. For output counts, throughput limits, and other per-size details, see [Flow sizes and capabilities](https://docs.aws.amazon.com/mediaconnect/latest/ug/flow-sizes-capabilities.html).
784
+
785
+ The construct validates flow size constraints at synthesis time based on the source protocol and NDI configuration:
786
+
787
+ - `MEDIUM` supports transport stream protocols (RTP, SRT, RIST, etc.) but not NDI or CDI
788
+ - `LARGE` supports transport streams and NDI, and is required when NDI is enabled
789
+ - `LARGE_4X` is required for CDI and JPEG XS protocols, and does not support transport streams or NDI
790
+
791
+ These are mutually exclusive — CDI/JPEG XS and NDI cannot coexist on the same flow because they require different flow sizes.
792
+
793
+ ```ts
794
+ declare const stack: Stack;
795
+ declare const ndiVpcInterface: VpcInterfaceConfig;
796
+ declare const efaInterface: VpcInterfaceConfig;
797
+ declare const videoStream: MediaStream;
798
+
799
+ // NDI requires LARGE, an encoding profile, and at least one discovery server
800
+ new Flow(stack, 'NdiFlow', {
801
+ flowSize: FlowSize.LARGE,
802
+ ndiConfig: {
803
+ ndiState: State.ENABLED,
804
+ ndiDiscoveryServers: [{
805
+ discoveryServerAddress: '10.0.0.10',
806
+ vpcInterface: ndiVpcInterface,
807
+ }],
808
+ },
809
+ encodingConfig: {
810
+ encodingProfile: EncodingProfile.CONTRIBUTION_H264_DEFAULT,
811
+ },
812
+ source: SourceConfiguration.ndi({
813
+ flowSourceName: 'ndi-source',
814
+ }),
815
+ });
816
+
817
+ // CDI and JPEG XS require LARGE_4X
818
+ new Flow(stack, 'CdiFlow', {
819
+ flowSize: FlowSize.LARGE_4X,
820
+ vpcInterfaces: [efaInterface],
821
+ mediaStreams: [videoStream],
822
+ source: SourceConfiguration.cdi({
823
+ flowSourceName: 'cdi-source',
824
+ vpcInterface: efaInterface,
825
+ port: 5000,
826
+ maxSyncBuffer: 100,
827
+ mediaStreamSourceConfigurations: [{
828
+ encoding: Encoding.RAW,
829
+ mediaStream: videoStream,
830
+ }],
831
+ }),
832
+ });
833
+ ```
834
+
835
+ For more information, see [Flow sizes and capabilities](https://docs.aws.amazon.com/mediaconnect/latest/ug/flow-sizes-capabilities.html).
836
+
837
+ ## Gateways
838
+
839
+ MediaConnect Gateways enable the deployment of on-premises resources for transporting live video to and from the AWS Cloud. Gateways are required for creating bridges.
840
+
841
+ ### Creating a Gateway
842
+
843
+ ```ts
844
+ declare const stack: Stack;
845
+
846
+ const productionNetwork = GatewayNetwork.define({
847
+ cidrBlock: '192.168.1.0/24',
848
+ name: 'production-network',
849
+ });
850
+
851
+ const gateway = new Gateway(stack, 'MyGateway', {
852
+ gatewayName: 'my-gateway',
853
+ egressCidrBlocks: ['10.0.0.0/16'],
854
+ networks: [productionNetwork],
855
+ });
856
+ ```
857
+
858
+ ### Importing an Existing Gateway
859
+
860
+ ```ts
861
+ declare const stack: Stack;
862
+
863
+ const gateway = Gateway.fromGatewayArn(stack, 'ImportedGateway',
864
+ 'arn:aws:mediaconnect:us-west-2:123456789012:gateway:1-XXXXXX',
865
+ );
866
+ ```
867
+
868
+ ## Bridges
869
+
870
+ MediaConnect bridges enable you to interconnect on-premises equipment with cloud-based workflows. Bridges support both ingress (on-premises to cloud) and egress (cloud to on-premises) scenarios.
871
+
872
+ ### Creating a Bridge
873
+
874
+ #### Ingress Bridge (On-premises to Cloud)
875
+
876
+ An ingress bridge receives content from on-premises equipment and makes it available in the cloud:
877
+
878
+ ```ts
879
+ declare const stack: Stack;
880
+
881
+ const productionNetwork = GatewayNetwork.define({
882
+ cidrBlock: '192.168.1.0/24',
883
+ name: 'production-network',
884
+ });
885
+
886
+ const gateway = new Gateway(stack, 'MyGateway', {
887
+ gatewayName: 'my-gateway',
888
+ egressCidrBlocks: ['10.0.0.0/16'],
889
+ networks: [productionNetwork],
890
+ });
891
+
892
+ const ingressBridge = new Bridge(stack, 'MyIngressBridge', {
893
+ bridgeName: 'my-ingress-bridge',
894
+ config: BridgeConfiguration.ingress({
895
+ maxBitrate: Bitrate.mbps(10),
896
+ maxOutputs: 2,
897
+ networkSources: [{
898
+ name: 'on-prem-source',
899
+ source: {
900
+ protocol: BridgeProtocol.RTP,
901
+ network: productionNetwork,
902
+ multicastIp: '239.1.1.1',
903
+ port: 5000,
904
+ },
905
+ }],
906
+ }),
907
+ gateway: gateway,
908
+ });
909
+ ```
910
+
911
+ #### Egress Bridge (Cloud to On-premises)
912
+
913
+ An egress bridge sends content from MediaConnect flows to on-premises equipment:
914
+
915
+ ```ts
916
+ declare const stack: Stack;
917
+ declare const gateway: Gateway;
918
+ declare const flow: Flow;
919
+ declare const vpcInterface: VpcInterfaceConfig;
920
+ declare const productionNetwork: GatewayNetwork;
921
+
922
+ const egressBridge = new Bridge(stack, 'MyEgressBridge', {
923
+ bridgeName: 'my-egress-bridge',
924
+ config: BridgeConfiguration.egress({
925
+ maxBitrate: Bitrate.mbps(10),
926
+ flowSources: [{
927
+ name: 'cloud-source',
928
+ source: {
929
+ flow: flow,
930
+ vpcInterface: vpcInterface,
931
+ },
932
+ }],
933
+ networkOutputs: [{
934
+ name: 'on-prem-output',
935
+ output: BridgeOutputConfiguration.network({
936
+ ipAddress: '192.168.1.200',
937
+ port: 5001,
938
+ network: productionNetwork,
939
+ protocol: BridgeProtocol.RTP,
940
+ ttl: 50,
941
+ }),
942
+ }],
943
+ }),
944
+ gateway: gateway,
945
+ });
946
+ ```
947
+
948
+ ### Bridge Sources
949
+
950
+ For failover scenarios, you can add additional sources to an existing bridge using the `BridgeSource` construct:
951
+
952
+ ```ts
953
+ declare const stack: Stack;
954
+ declare const bridge: Bridge;
955
+ declare const flow: Flow;
956
+
957
+ // Add a flow source to an egress bridge (requires failover to be enabled)
958
+ const additionalSource = new BridgeSource(stack, 'AdditionalSource', {
959
+ bridgeSourceName: 'backup-source',
960
+ bridge: bridge,
961
+ source: BridgeSourceConfiguration.flow({
962
+ flow: flow,
963
+ }),
964
+ });
965
+ ```
966
+
967
+ ### Bridge Outputs
968
+
969
+ Bridge outputs are configured as part of the bridge configuration for egress bridges. They define where content exits the bridge to on-premises equipment.
970
+
971
+ ```ts
972
+ declare const productionNetwork: GatewayNetwork;
973
+
974
+ const networkConfig = BridgeOutputConfiguration.network({
975
+ ipAddress: '192.168.1.200',
976
+ port: 5001,
977
+ network: productionNetwork,
978
+ protocol: BridgeProtocol.RTP,
979
+ ttl: 50,
980
+ });
981
+
982
+ const namedOutput = { name: 'on-prem-output', output: networkConfig };
983
+ ```
984
+
985
+ ## Encryption
986
+
987
+ MediaConnect supports encryption for sources, outputs, and entitlements. This package provides type-safe encryption configuration structs that match the encryption requirements for different protocols.
988
+
989
+ ### Encryption Types
990
+
991
+ MediaConnect supports two types of encryption:
992
+
993
+ 1. **Static Key Encryption** - Used for Zixi Push/Pull protocols and entitlements
994
+ 2. **SRT Password Encryption** - Used for SRT Listener and SRT Caller protocols
995
+
996
+ Note: CFN exposes only `static-key` and `srt-password` for flow output encryption today; SPEKE is not currently part of the surface.
997
+
998
+ **Auto-created IAM role.** Every encryption struct accepts an optional `role`. Omit it and the consuming construct creates a scoped role for you: trust policy for `mediaconnect.amazonaws.com` with `aws:SourceAccount` + `aws:SourceArn` conditions (confused-deputy protection), and just enough permission to read the provided secret (including `kms:Decrypt` when the secret uses a customer-managed KMS key).
999
+
1000
+ **Providing your own role.** If you supply a `role`, it's used as-is — the construct does **not** grant it any permissions. You must grant it the necessary permissions yourself. Provide your own role when you need stricter control or a shared identity.
1001
+
1002
+ **Trust-policy scope: flows vs. routers.** When the L2 auto-creates a role, it also pins `aws:SourceArn` to the consuming resource:
1003
+
1004
+ - **Flows** — the trust policy pins the flow ARN (`arn:...:flow:*:<flow-name>`). The `*` wildcards the service-assigned id segment; the flow name is fixed at create time.
1005
+ - **Routers** — the trust policy can only pin a wildcarded ARN (`arn:...:routerInput:*` / `arn:...:routerOutput:*`). Router I/O ARNs use a service-generated id segment that is unknown at synth time, and using the live ARN attribute would create a CloudFormation dependency cycle (role → router → role). If you need per-resource pinning, supply your own `role` with a trust condition that pins the exact ARN — you can compute it from the resource's `routerInputId` / `routerOutputId` after first deploy and apply it on a follow-up deploy.
1006
+
1007
+ ### Static Key Encryption
1008
+
1009
+ Use a static-key encryption struct for Zixi protocols and entitlements. This requires an encryption algorithm (AES128, AES192, or AES256). Pass it inline where the construct asks for it:
1010
+
1011
+ ```ts
1012
+ declare const stack: Stack;
1013
+ declare const flow: Flow;
1014
+ declare const role: iam.IRole;
1015
+ declare const secret: secretsmanager.ISecret;
1016
+
1017
+ new FlowEntitlement(stack, 'MyEntitlement', {
1018
+ flow,
1019
+ subscribers: ['111122223333'],
1020
+ description: 'Grant partner access to live feed',
1021
+ encryption: {
1022
+ role,
1023
+ secret,
1024
+ algorithm: EncryptionAlgorithm.AES256,
1025
+ },
1026
+ });
1027
+ ```
1028
+
1029
+ ### SRT Password Encryption
1030
+
1031
+ SRT protocols take an encryption struct with just `role` and `secret` — no algorithm:
1032
+
1033
+ ```ts
1034
+ declare const stack: Stack;
1035
+ declare const flow: Flow;
1036
+ declare const role: iam.IRole;
1037
+ declare const secret: secretsmanager.ISecret;
1038
+
1039
+ new FlowOutput(stack, 'SrtOutput', {
1040
+ flow,
1041
+ output: OutputConfiguration.srtCaller({
1042
+ destination: '203.0.113.100',
1043
+ port: 7000,
1044
+ encryption: { role, secret },
1045
+ }),
1046
+ });
1047
+ ```
1048
+
1049
+ ### Using Encryption with Sources
1050
+
1051
+ Apply encryption when configuring flow sources:
1052
+
1053
+ ```ts
1054
+ declare const stack: Stack;
1055
+ declare const role: iam.IRole;
1056
+ declare const secret: secretsmanager.ISecret;
1057
+
1058
+ // SRT Listener source with encryption
1059
+ const flow = new Flow(stack, 'MyFlow', {
1060
+ source: SourceConfiguration.srtListener({
1061
+ flowSourceName: 'encrypted-source',
1062
+ port: 5000,
1063
+ network: NetworkConfiguration.publicNetwork('203.0.113.0/24'),
1064
+ decryption: { role, secret },
1065
+ }),
1066
+ });
1067
+
1068
+ // Zixi Push source with encryption
1069
+ const flow2 = new Flow(stack, 'MyFlow2', {
1070
+ source: SourceConfiguration.zixiPush({
1071
+ flowSourceName: 'encrypted-zixi-source',
1072
+ maxLatency: Duration.millis(2000),
1073
+ network: NetworkConfiguration.publicNetwork('203.0.113.0/24'),
1074
+ decryption: {
1075
+ role,
1076
+ secret,
1077
+ algorithm: EncryptionAlgorithm.AES256,
1078
+ },
1079
+ }),
1080
+ });
1081
+ ```
1082
+
1083
+ ### Using Encryption with Outputs
1084
+
1085
+ Apply encryption when configuring flow outputs:
1086
+
1087
+ ```ts
1088
+ declare const stack: Stack;
1089
+ declare const flow: Flow;
1090
+ declare const role: iam.IRole;
1091
+ declare const secret: secretsmanager.ISecret;
1092
+
1093
+ // SRT Caller output with encryption
1094
+ const output = new FlowOutput(stack, 'EncryptedOutput', {
1095
+ flow: flow,
1096
+ description: 'Encrypted SRT output',
1097
+ output: OutputConfiguration.srtCaller({
1098
+ destination: '203.0.113.100',
1099
+ port: 7000,
1100
+ encryption: { role, secret },
1101
+ }),
1102
+ });
1103
+ ```
1104
+
1105
+ ### Using Encryption with Entitlements
1106
+
1107
+ Entitlements use static key encryption:
1108
+
1109
+ ```ts
1110
+ declare const stack: Stack;
1111
+ declare const flow: Flow;
1112
+ declare const role: iam.IRole;
1113
+ declare const secret: secretsmanager.ISecret;
1114
+
1115
+ const entitlement = new FlowEntitlement(stack, 'MyEntitlement', {
1116
+ flow: flow,
1117
+ description: 'Grant partner access to live feed',
1118
+ subscribers: ['111122223333'],
1119
+ encryption: {
1120
+ role,
1121
+ secret,
1122
+ algorithm: EncryptionAlgorithm.AES256,
1123
+ },
1124
+ });
1125
+ ```
1126
+
1127
+ ### Router Transit Encryption
1128
+
1129
+ When integrating flows with routers, use transit encryption to secure the connection between the flow and router:
1130
+
1131
+ ```ts
1132
+ declare const stack: Stack;
1133
+ declare const flow: Flow;
1134
+ declare const role: iam.IRole;
1135
+ declare const secret: secretsmanager.ISecret;
1136
+ declare const existingRouterOutput: RouterOutput;
1137
+
1138
+ // Flow output to router with transit encryption
1139
+ const routerOutput = new FlowOutput(stack, 'RouterOutput', {
1140
+ flow: flow,
1141
+ output: OutputConfiguration.router({
1142
+ encryption: { role, secret },
1143
+ }),
1144
+ });
1145
+
1146
+ // Flow source from router with transit encryption
1147
+ const flowFromRouter = new Flow(stack, 'FlowFromRouter', {
1148
+ source: SourceConfiguration.router({
1149
+ routerOutput: existingRouterOutput,
1150
+ decryption: { role, secret },
1151
+ }),
1152
+ });
1153
+ ```
1154
+
1155
+ ### Router SRT Encryption
1156
+
1157
+ Router outputs using SRT protocols use `RouterSrtEncryption` for encryption:
1158
+
1159
+ ```ts
1160
+ declare const stack: Stack;
1161
+ declare const networkInterface: RouterNetworkInterface;
1162
+ declare const role: iam.IRole;
1163
+ declare const secret: secretsmanager.ISecret;
1164
+
1165
+ const output = new RouterOutput(stack, 'EncryptedSrtOutput', {
1166
+ routerOutputName: 'encrypted-srt-output',
1167
+ maximumBitrate: Bitrate.mbps(10),
1168
+ routingScope: RoutingScope.REGIONAL,
1169
+ tier: RouterOutputTier.OUTPUT_50,
1170
+ configuration: RouterOutputConfiguration.standard({
1171
+ protocol: RouterOutputProtocol.srtCaller({
1172
+ destinationAddress: '203.0.113.100',
1173
+ destinationPort: 9001,
1174
+ minimumLatency: Duration.millis(200),
1175
+ encryptionConfiguration: { role, secret },
1176
+ }),
1177
+ networkInterface: networkInterface,
1178
+ }),
1179
+ });
1180
+ ```
1181
+
1182
+ Note: `RouterSrtEncryption` is distinct from `SrtPasswordEncryption` (used on flow sources/outputs) — router outputs use a simpler CFN shape without a `keyType` discriminator.
1183
+
1184
+ ## CloudWatch Metrics
1185
+
1186
+ Flows and Bridges expose CloudWatch metric helpers for monitoring. You can create alarms and dashboards using these metrics:
1187
+
1188
+ ```ts
1189
+ declare const flow: Flow;
1190
+ declare const stack: Stack;
1191
+
1192
+ // Create a CloudWatch alarm on source bitrate
1193
+ const alarm = flow.metricSourceBitrate().createAlarm(stack, 'LowBitrate', {
1194
+ threshold: 1000000,
1195
+ evaluationPeriods: 1,
1196
+ });
1197
+
1198
+ // Monitor unrecovered packets
1199
+ flow.metricSourceNotRecoveredPackets().createAlarm(stack, 'PacketLoss', {
1200
+ threshold: 100,
1201
+ evaluationPeriods: 2,
1202
+ });
1203
+
1204
+ // Track total packets with custom options
1205
+ const totalPackets = flow.metricSourceTotalPackets({
1206
+ statistic: 'sum',
1207
+ period: Duration.minutes(5),
1208
+ });
1209
+ ```
1210
+
1211
+ ### Flow metrics
1212
+
1213
+ - `metricSourceBitrate()` - Bitrate of content ingested into the flow (average)
1214
+ - `metricSourceNotRecoveredPackets()` - Packets lost in transit that were not recovered by error correction (sum)
1215
+ - `metricSourceTotalPackets()` - Total packets received by the flow sources (sum)
1216
+ - `metricSourceSelected()` - Indicates which source is being used under Failover mode (max; 1 = active, 0 = standby)
1217
+ - `metricSourceConnected()` - Source connection state for Zixi, SRT, and RIST (min; 1 = connected, 0 = disconnected)
1218
+ - `metricSourceDisconnections()` - Number of times the source transitioned from connected to disconnected (sum)
1219
+ - `metricSourceDroppedPackets()` - Packets lost before any error correction took place (sum)
1220
+ - `metricSourcePacketLossPercent()` - Percentage of packets lost during transit, even if they were recovered (average)
1221
+ - `metricSourceRoundTripTime()` - Round-trip time to the source for RIST, Zixi, and SRT (average, milliseconds)
1222
+ - `metricSourceJitter()` - Current network jitter of the source (average, milliseconds)
1223
+ - `metric(metricName)` - Create a custom metric by name
1224
+
1225
+ ### Bridge metrics
1226
+
1227
+ Bridge metrics are dimensioned by `BridgeARN`. The underlying CloudWatch metric name is chosen automatically based on whether the bridge is ingress or egress.
1228
+
1229
+ - `metricSourceBitrate(bridgeSourceName)` - Bitrate of a specific bridge source (average)
1230
+ - `metricSourcePacketLossPercent(bridgeSourceName)` - Percentage of packets lost on a specific bridge source (average)
1231
+ - `metricFailoverSwitches()` - Total number of times the bridge switches between sources under `FAILOVER` failover mode (sum)
1232
+ - `metric(metricName)` - Create a custom metric by name
1233
+
1234
+ ### Router Input metrics
1235
+
1236
+ Router input metrics are dimensioned by `RouterInputARN`.
1237
+
1238
+ - `metricBitrate()` - Bitrate of the router input's payload (average)
1239
+ - `metricNotRecoveredPackets()` - Packets lost in transit that were not recovered by error correction (sum)
1240
+ - `metricTotalPackets()` - Total number of packets received by the router input (sum)
1241
+ - `metricConnected()` - Connection state for SRT sources (min; 1 = connected, 0 = disconnected)
1242
+ - `metricContinuityCounterErrors()` - Continuity counter errors in the transport stream (sum)
1243
+ - `metricLatency()` - Recovery latency of the input stream for RIST, SRT, and RTP-FEC (average, milliseconds)
1244
+ - `metricFailoverSwitches()` - Total times the router input switched sources under Failover mode (sum)
1245
+ - `metric(metricName)` - Create a custom metric by name
1246
+
1247
+ ### Router Output metrics
1248
+
1249
+ Router output metrics are dimensioned by `RouterOutputARN`.
1250
+
1251
+ - `metricBitrate()` - Bitrate of the router output's payload (average)
1252
+ - `metricTotalPackets()` - Total number of packets sent by the router output (sum)
1253
+ - `metricConnected()` - Connection state for SRT outputs (min; 1 = connected, 0 = disconnected)
1254
+ - `metricArqRequests()` - Retransmitted packets requested through ARQ for RIST and SRT outputs (sum)
1255
+ - `metric(metricName)` - Create a custom metric by name
1256
+
1257
+ ### Gateway metrics
1258
+
1259
+ Gateway metrics are dimensioned by `GatewayARN`. Pass extra dimensions such as `NetworkName`, `InstanceId`, or `BridgeSourceName` via `props.dimensionsMap` to narrow to a specific network, appliance, or bridge source.
1260
+
1261
+ - `metricEgressBridgeTotalPackets()` - Total packets sent from egress bridges hosted on the gateway (sum)
1262
+ - `metricEgressBridgeDroppedPackets()` - Packets dropped by egress bridges hosted on the gateway (sum)
1263
+ - `metricIngressBridgeTotalPackets()` - Total packets received by ingress bridges hosted on the gateway (sum)
1264
+ - `metricIngressBridgeDroppedPackets()` - Packets dropped by ingress bridges hosted on the gateway (sum)
1265
+ - `metric(metricName)` - Create a custom metric by name (e.g. `IngressBridgeBitRate`, `EgressBridgeBitRate`, `IngressBridgeSourcePacketLossPercent`)
1266
+
1267
+ Pair the total + dropped helpers to build a dropped-packet percentage chart — for example, divide `metricEgressBridgeDroppedPackets()` by `metricEgressBridgeTotalPackets()` in a math expression.
1268
+
1269
+ All metrics support standard CloudWatch metric options for customizing period, statistic, and dimensions.
1270
+
1271
+ ## Public CIDR warnings
1272
+
1273
+ Several constructs accept CIDR ranges that determine who can contribute content or pull outputs. Passing an open range (`0.0.0.0/0` or any `/0` prefix) makes the resource reachable from anywhere on the public internet, which is rarely what you want. The module emits synthesis-time warnings when it detects an open range on:
1274
+
1275
+ - `GatewayProps.egressCidrBlocks`
1276
+ - `NetworkConfiguration.publicNetwork(cidr)` used on flow sources
1277
+ - `cidrAllowList` on Zixi Push / Zixi Pull / SRT Listener flow outputs
1278
+ - `RouterNetworkConfiguration.publicNetwork({ cidr })`
1279
+
1280
+ Restrict each range to the narrowest set of addresses that actually need access.