@aws-cdk/aws-mediapackagev2-alpha 2.253.1-alpha.0 → 2.255.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/.jsii +176 -3
- package/.jsii.tabl.json.gz +0 -0
- package/.warnings.jsii.js +11 -0
- package/README.md +19 -2
- package/lib/channel-policy.js +1 -1
- package/lib/channel.js +3 -3
- package/lib/cloudfront-origin.d.ts +65 -0
- package/lib/cloudfront-origin.js +101 -0
- package/lib/endpoint.js +19 -16
- package/lib/group.js +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +2 -1
- package/lib/mediapackagev2-grants.generated.js +1 -1
- package/lib/origin-endpoint-policy.js +1 -1
- package/package.json +6 -6
- package/rosetta/default.ts-fixture +1 -0
package/.jsii
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"url": "https://aws.amazon.com"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"aws-cdk-lib": "^2.
|
|
11
|
+
"aws-cdk-lib": "^2.255.0",
|
|
12
12
|
"constructs": "^10.5.0"
|
|
13
13
|
},
|
|
14
14
|
"dependencyClosure": {
|
|
@@ -8959,7 +8959,7 @@
|
|
|
8959
8959
|
},
|
|
8960
8960
|
"name": "@aws-cdk/aws-mediapackagev2-alpha",
|
|
8961
8961
|
"readme": {
|
|
8962
|
-
"markdown": "# AWS::MediaPackageV2 Construct Library\n<!--BEGIN STABILITY BANNER-->\n\n---\n\n\n\n> The APIs of higher level constructs in this module are experimental and under active development.\n> They are subject to non-backward compatible changes or removal in any future version. These are\n> not subject to the [Semantic Versioning](https://semver.org/) model and breaking changes will be\n> announced in the release notes. This means that while you may use them, you may need to update\n> your source code when upgrading to a newer version of this package.\n\n---\n\n<!--END STABILITY BANNER-->\n\n## AWS Elemental MediaPackage V2\n\nMediaPackage delivers high-quality video without concern for capacity and makes it easier to implement popular DVR features such as start over, pause, and rewind. Your content will be protected with comprehensive support for DRM. The service seamlessly integrates with other AWS media services as a complete set of tools for cloud-based video processing and delivery.\n\nThis package contains constructs for working with AWS Elemental MediaPackage V2. Allowing you to define AWS Elemental MediaPackage V2 Channel Groups, Channels, Origin Endpoints, Channel Policies and Origin Endpoint Policies.\n\nFor further information on AWS Elemental MediaPackage V2, see [the documentation](https://aws.amazon.com/mediapackage/).\n\nThe following example creates an AWS Elemental MediaPackage V2 Channel Group, Channel and Origin Endpoint:\n\n```ts\ndeclare const stack: Stack;\nconst group = new ChannelGroup(stack, 'MyChannelGroup', {\n channelGroupName: 'my-test-channel-group',\n});\n\nconst channel = new Channel(stack, 'MyChannel', {\n channelGroup: group,\n channelName: 'my-testchannel',\n input: InputConfiguration.cmaf(),\n});\n\nconst endpoint = new OriginEndpoint(stack, 'MyOriginEndpoint', {\n channel,\n originEndpointName: 'my-test-endpoint',\n segment: Segment.cmaf(),\n manifests: [Manifest.hls({\n manifestName: 'index',\n })],\n});\n```\n\n## Using Factory Methods\n\n```ts\ndeclare const stack: Stack;\n\n// Create a channel group\nconst group = new ChannelGroup(stack, 'MyChannelGroup', {\n channelGroupName: 'my-channel-group',\n});\n\n// Add a channel using the factory method\nconst channel = group.addChannel('MyChannel', {\n channelName: 'my-channel',\n input: InputConfiguration.cmaf(),\n});\n\n// Add an origin endpoint using the factory method\nconst endpoint = channel.addOriginEndpoint('MyEndpoint', {\n originEndpointName: 'my-endpoint',\n segment: Segment.cmaf(),\n manifests: [Manifest.hls({ manifestName: 'index' })],\n});\n```\n\n## Channel Group\n\nA channel group is the top-level resource that consists of channels and origin endpoints associated with it.\n\nThe following code creates a Channel Group:\n\n```ts\ndeclare const stack: Stack;\nconst group = new ChannelGroup(stack, 'MyChannelGroup', {\n channelGroupName: 'my-test-channel-group',\n});\n```\n\nThe following code imports an existing channel group using the name attribute:\n\n```ts\ndeclare const stack: Stack;\nconst channelGroup = ChannelGroup.fromChannelGroupAttributes(stack, 'ImportedChannelGroup', {\n channelGroupName: 'MyChannelGroup',\n});\n```\n\nYou can also import from an ARN, which automatically extracts the name and region:\n\n```ts\ndeclare const stack: Stack;\nconst channelGroup = ChannelGroup.fromChannelGroupArn(stack, 'ImportedChannelGroup',\n 'arn:aws:mediapackagev2:us-west-2:123456789012:channelGroup/MyChannelGroup',\n);\n```\n\nFor cross-region imports, pass the `region` parameter to ensure the correct ARN is constructed:\n\n```ts\ndeclare const stack: Stack;\nconst channelGroup = ChannelGroup.fromChannelGroupAttributes(stack, 'ImportedChannelGroup', {\n channelGroupName: 'MyChannelGroup',\n region: 'us-west-2',\n});\n```\n\n## Channel\n\nA channel is part of a channel group and represents the entry point for a content stream into MediaPackage.\n\n### Input Configuration\n\nChannels support two input types: HLS and CMAF.\n\n```ts\ndeclare const stack: Stack;\ndeclare const group: ChannelGroup;\n\nconst hlsChannel = new Channel(stack, 'HlsChannel', {\n channelGroup: group,\n input: InputConfiguration.hls(),\n});\n\nconst cmafChannel = new Channel(stack, 'CmafChannel', {\n channelGroup: group,\n input: InputConfiguration.cmaf({\n inputSwitchConfiguration: {\n mqcsInputSwitching: true,\n },\n outputHeaders: [HeadersCMSD.MQCS],\n }),\n});\n\nconst simpleCmafChannel = new Channel(stack, 'SimpleCmafChannel', {\n channelGroup: group,\n input: InputConfiguration.cmaf({\n outputHeaders: [HeadersCMSD.MQCS],\n }),\n});\n```\n\n### Importing an Existing Channel\n\nThe following code imports an existing channel using the name attributes:\n\n```ts\ndeclare const stack: Stack;\nconst channel = Channel.fromChannelAttributes(stack, 'ImportedChannel', {\n channelName: 'MyChannel',\n channelGroupName: 'MyChannelGroup',\n});\n```\n\nYou can also import from an ARN:\n\n```ts\ndeclare const stack: Stack;\nconst channel = Channel.fromChannelArn(stack, 'ImportedChannel',\n 'arn:aws:mediapackagev2:us-west-2:123456789012:channelGroup/MyGroup/channel/MyChannel',\n);\n```\n\nImported channels expose a `region` property, which is parsed from the ARN or falls back to the importing stack's region.\n\n### Channel Resource Policy\n\nThe following code creates a resource policy directly on the channel. This\nwill automatically create a policy on the first call:\n\n```ts\ndeclare const channel: Channel;\nchannel.addToResourcePolicy(new PolicyStatement({\n sid: 'AllowMediaLiveRoleToAccessEmpChannel',\n principals: [new ArnPrincipal('arn:aws:iam::AccountID:role/MediaLiveAccessRole')],\n effect: Effect.ALLOW,\n actions: ['mediapackagev2:PutObject'],\n resources: [channel.channelArn],\n}));\n```\n\n## Origin Endpoint\n\n```ts\ndeclare const stack: Stack;\ndeclare const channel: Channel;\nnew OriginEndpoint(stack, 'myendpoint', {\n channel,\n originEndpointName: 'my-test-endpoint',\n segment: Segment.cmaf(),\n manifests: [\n Manifest.hls({\n manifestName: 'index',\n }),\n ],\n});\n```\n\nThe following code imports an existing origin endpoint using the name attributes:\n\n```ts\ndeclare const stack: Stack;\nconst originEndpoint = OriginEndpoint.fromOriginEndpointAttributes(stack, 'ImportedOriginEndpoint', {\n channelGroupName: 'MyChannelGroup',\n channelName: 'MyChannel',\n originEndpointName: 'MyExampleOriginEndpoint',\n});\n```\n\nYou can also import from an ARN:\n\n```ts\ndeclare const stack: Stack;\nconst originEndpoint = OriginEndpoint.fromOriginEndpointArn(stack, 'ImportedOriginEndpoint',\n 'arn:aws:mediapackagev2:us-west-2:123456789012:channelGroup/MyGroup/channel/MyChannel/originEndpoint/MyEndpoint',\n);\n```\n\nThe following code creates a resource policy on the origin endpoint. This\nwill automatically create a policy on the first call:\n\n```ts\ndeclare const origin: OriginEndpoint;\n\norigin.addToResourcePolicy(new PolicyStatement({\n sid: 'AllowRequestsFromCloudFront',\n principals: [new ServicePrincipal('cloudfront.amazonaws.com')],\n effect: Effect.ALLOW,\n actions: ['mediapackagev2:GetHeadObject', 'mediapackagev2:GetObject'],\n resources: [origin.originEndpointArn],\n conditions: {\n StringEquals: {\n 'aws:SourceArn': 'arn:aws:cloudfront::123456789012:distribution/AAAAAAAAA',\n },\n },\n}));\n```\n\n## Granting Permissions\n\n### Granting Ingest Access to MediaLive\n\nTo allow AWS Elemental MediaLive to ingest content into a MediaPackage channel, use the `grants.ingest()` method:\n\n```ts\ndeclare const channel: Channel;\ndeclare const mediaLiveRole: iam.IRole;\n\n// Grant MediaLive permission to ingest content\nchannel.grants.ingest(mediaLiveRole);\n```\n\n### CloudFront Integration\n\nMediaPackage origin endpoints are designed to be used with Content Delivery Network (CDN) like Amazon CloudFront distributions. CloudFront provides caching, DDoS protection, and global content delivery for your streaming content.\n\nTo allow a CloudFront distribution to access a MediaPackage origin endpoint, add a resource policy with the CloudFront service principal:\n\n```ts\ndeclare const originEndpoint: OriginEndpoint;\ndeclare const distribution: cloudfront.Distribution;\n\noriginEndpoint.addToResourcePolicy(new iam.PolicyStatement({\n sid: 'AllowCloudFrontServicePrincipal',\n principals: [new iam.ServicePrincipal('cloudfront.amazonaws.com')],\n effect: iam.Effect.ALLOW,\n actions: ['mediapackagev2:GetObject', 'mediapackagev2:GetHeadObject'],\n resources: [originEndpoint.originEndpointArn],\n conditions: {\n StringEquals: {\n 'aws:SourceArn': distribution.distributionArn,\n },\n },\n}));\n```\n\nYou can complete the confirmation with an OAC (Origin Access Control) Policy on the CloudFront Distribution.\n\n## Manifest Configuration\n\nMediaPackage V2 supports multiple manifest formats: HLS, Low-Latency HLS (LL-HLS), DASH, and Microsoft Smooth Streaming (MSS).\n\n### HLS Manifests\n\n```ts\ndeclare const channel: Channel;\n\nnew OriginEndpoint(this, 'Endpoint', {\n channel,\n segment: Segment.cmaf(),\n manifests: [\n Manifest.hls({\n manifestName: 'index',\n manifestWindow: Duration.seconds(60),\n programDateTimeInterval: Duration.seconds(60),\n scteAdMarkerHls: AdMarkerHls.DATERANGE,\n }),\n ],\n});\n```\n\n### Low-Latency HLS Manifests\n\n```ts\ndeclare const channel: Channel;\n\nnew OriginEndpoint(this, 'Endpoint', {\n channel,\n segment: Segment.cmaf(),\n manifests: [\n Manifest.lowLatencyHLS({\n manifestName: 'index',\n manifestWindow: Duration.seconds(30),\n programDateTimeInterval: Duration.seconds(5),\n childManifestName: 'child',\n }),\n ],\n});\n```\n\n### DASH Manifests\n\n```ts\ndeclare const channel: Channel;\n\nnew OriginEndpoint(this, 'Endpoint', {\n channel,\n segment: Segment.cmaf(),\n manifests: [\n Manifest.dash({\n manifestName: 'index',\n manifestWindow: Duration.seconds(60),\n minBufferTime: Duration.seconds(30),\n minUpdatePeriod: Duration.seconds(10),\n segmentTemplateFormat: SegmentTemplateFormat.NUMBER_WITH_TIMELINE,\n periodTriggers: [\n DashPeriodTriggers.AVAILS,\n DashPeriodTriggers.DRM_KEY_ROTATION,\n ],\n }),\n ],\n});\n```\n\n### MSS Manifests\n\n```ts\ndeclare const channel: Channel;\n\nnew OriginEndpoint(this, 'Endpoint', {\n channel,\n segment: Segment.ism(),\n manifests: [\n Manifest.mss({\n manifestName: 'index',\n manifestWindow: Duration.seconds(60),\n manifestLayout: MssManifestLayout.COMPACT,\n }),\n ],\n});\n```\n\n### Multiple Manifests\n\nYou can configure multiple manifest formats for a single origin endpoint:\n\n```ts\ndeclare const channel: Channel;\n\nnew OriginEndpoint(this, 'Endpoint', {\n channel,\n segment: Segment.cmaf(),\n manifests: [\n Manifest.hls({ manifestName: 'hls' }),\n Manifest.dash({ manifestName: 'dash' }),\n ],\n});\n```\n\n| Segment type | Supported manifests |\n|--------|--------|\n| Segment.cmaf() | HLS, LL-HLS, DASH |\n| Segment.ts() | HLS, LL-HLS |\n| Segment.ism() | MSS |\n\nEach origin endpoint has a single segment configuration. If you need segments with different configurations, use multiple origin endpoints on the same channel.\n\n@see https://docs.aws.amazon.com/mediapackage/latest/userguide/endpoints-create.html\n\n## Manifest Filtering\n\nManifest filters control which variants are included in the manifest. Filters are type-safe and validated against the [MediaPackage manifest filtering rules](https://docs.aws.amazon.com/mediapackage/latest/userguide/manifest-filter-query-parameters.html).\n\n| Filter | Method |\n|--------|--------|\n| Audio / video bitrate | `bitrate()`, `bitrateRange()`, `bitrateCombo()` |\n| Audio channels, sample rate, video height, framerate, trickplay height | `numeric()`, `numericList()`, `numericRange()`, `numericCombo()` |\n| Audio codec | `audioCodec()`, `audioCodecList()` |\n| Video codec | `videoCodec()`, `videoCodecList()` |\n| Video dynamic range | `videoDynamicRange()`, `videoDynamicRangeList()` |\n| Trickplay type | `trickplayType()`, `trickplayTypeList()` |\n| Audio / subtitle language | `text()`, `textList()` |\n| Advanced patterns | `custom()` |\n\nThe following example creates an HD streaming endpoint that serves only H.264/H.265 content between 1–5 Mbps with stereo audio in English or French:\n\n```ts\ndeclare const channel: Channel;\n\nnew OriginEndpoint(this, 'Endpoint', {\n channel,\n segment: Segment.cmaf(),\n manifests: [\n Manifest.hls({\n manifestName: 'index',\n filterConfiguration: {\n manifestFilter: [\n ManifestFilter.bitrateRange(BitrateFilterKey.VIDEO_BITRATE, Bitrate.mbps(1), Bitrate.mbps(5)),\n ManifestFilter.numericRange(NumericFilterKey.VIDEO_HEIGHT, 720, 1080),\n ManifestFilter.videoCodecList([VideoCodec.H264, VideoCodec.H265]),\n ManifestFilter.numeric(NumericFilterKey.AUDIO_CHANNELS, 2),\n ManifestFilter.textList(TextFilterKey.AUDIO_LANGUAGE, ['en-US', 'fr']),\n ],\n timeDelay: Duration.seconds(30),\n },\n }),\n ],\n});\n```\n\nFor advanced patterns that combine ranges and single values, use `numericCombo()` or `bitrateCombo()`:\n\n```ts\ndeclare const channel: Channel;\n\nnew OriginEndpoint(this, 'Endpoint', {\n channel,\n segment: Segment.cmaf(),\n manifests: [\n Manifest.hls({\n manifestName: 'index',\n filterConfiguration: {\n manifestFilter: [\n // video_height:240-360,720-1080,1440\n ManifestFilter.numericCombo(NumericFilterKey.VIDEO_HEIGHT, [\n NumericExpression.range(240, 360),\n NumericExpression.range(720, 1080),\n NumericExpression.value(1440),\n ]),\n ],\n },\n }),\n ],\n});\n```\n\n### DRM Settings\n\nYou can exclude session keys from HLS and LL-HLS multivariant playlists using the `drmSettings` filter configuration. This improves compatibility with legacy HLS clients and provides more granular access control:\n\n```ts\ndeclare const channel: Channel;\n\nnew OriginEndpoint(this, 'Endpoint', {\n channel,\n segment: Segment.cmaf(),\n manifests: [\n Manifest.hls({\n manifestName: 'index',\n filterConfiguration: {\n drmSettings: [DrmSettingsKey.EXCLUDE_SESSION_KEYS],\n },\n }),\n ],\n});\n```\n\n## Start Tag Configuration\n\nConfigure where playback should start in HLS and LL-HLS manifests using the EXT-X-START tag:\n\n```ts\ndeclare const channel: Channel;\n\nnew OriginEndpoint(this, 'Endpoint', {\n channel,\n segment: Segment.cmaf(),\n manifests: [\n Manifest.hls({\n manifestName: 'index',\n startTag: StartTag.of(10),\n }),\n ],\n});\n```\n\n## Segment Configuration\n\nConfigure segment settings for your origin endpoint.\n\n```ts\ndeclare const channel: Channel;\n\nnew OriginEndpoint(this, 'TsEndpoint', {\n channel,\n segment: Segment.ts({\n duration: Duration.seconds(6),\n name: 'segment',\n includeDvbSubtitles: true,\n useAudioRenditionGroup: true,\n includeIframeOnlyStreams: false,\n scteFilter: [\n ScteMessageType.BREAK,\n ScteMessageType.DISTRIBUTOR_ADVERTISEMENT,\n ],\n }),\n manifests: [Manifest.hls({ manifestName: 'index' })],\n});\n\nnew OriginEndpoint(this, 'CmafEndpoint', {\n channel,\n segment: Segment.cmaf({\n duration: Duration.seconds(6),\n name: 'segment',\n includeIframeOnlyStreams: true,\n scteFilter: [ScteMessageType.DISTRIBUTOR_ADVERTISEMENT],\n }),\n manifests: [Manifest.hls({ manifestName: 'index' })],\n});\n\nnew OriginEndpoint(this, 'Endpoint', {\n channel,\n segment: Segment.cmaf(),\n manifests: [Manifest.hls({ manifestName: 'index' })],\n});\n```\n\n## Encryption and DRM\n\nProtect your content with encryption using SPEKE (Secure Packager and Encoder Key Exchange). Each container type has its own encryption class with type-safe options:\n\n### CMAF Encryption\n\n```ts\ndeclare const channel: Channel;\ndeclare const spekeRole: iam.IRole;\n\nnew OriginEndpoint(this, 'Endpoint', {\n channel,\n segment: Segment.cmaf({\n encryption: CmafEncryption.speke({\n method: CmafEncryptionMethod.CBCS,\n drmSystems: [CmafDrmSystem.FAIRPLAY, CmafDrmSystem.WIDEVINE],\n resourceId: 'my-content-id',\n url: 'https://example.com/speke',\n role: spekeRole,\n keyRotationInterval: Duration.seconds(300),\n audioPreset: PresetSpeke20Audio.PRESET_AUDIO_2,\n videoPreset: PresetSpeke20Video.PRESET_VIDEO_2,\n }),\n }),\n manifests: [Manifest.hls({ manifestName: 'index' })],\n});\n```\n\n### TS Encryption\n\n```ts\ndeclare const channel: Channel;\ndeclare const spekeRole: iam.IRole;\n\nnew OriginEndpoint(this, 'TsEndpoint', {\n channel,\n segment: Segment.ts({\n encryption: TsEncryption.speke({\n method: TsEncryptionMethod.SAMPLE_AES,\n resourceId: 'my-content-id',\n url: 'https://example.com/speke',\n role: spekeRole,\n }),\n }),\n manifests: [Manifest.hls({ manifestName: 'index' })],\n});\n```\n\nTS encryption defaults the DRM system based on the method: FairPlay for `SAMPLE_AES`, Clear Key AES 128 for `AES_128`. You can override this with the `drmSystems` property using `TsDrmSystem`.\n\n### Content Key Encryption\n\nYou can add content key encryption by providing a certificate imported into AWS Certificate Manager. Your DRM key provider must support content key encryption for this to work:\n\n```ts\ndeclare const channel: Channel;\ndeclare const spekeRole: iam.IRole;\ndeclare const certificate: certificatemanager.ICertificate;\n\nnew OriginEndpoint(this, 'Endpoint', {\n channel,\n segment: Segment.cmaf({\n encryption: CmafEncryption.speke({\n method: CmafEncryptionMethod.CBCS,\n drmSystems: [CmafDrmSystem.FAIRPLAY],\n resourceId: 'my-content-id',\n url: 'https://example.com/speke',\n role: spekeRole,\n certificate,\n }),\n }),\n manifests: [Manifest.hls({ manifestName: 'index' })],\n});\n```\n\n### Excluding Segment DRM Metadata\n\nFor CMAF content, you can exclude DRM metadata from segments:\n\n```ts\ndeclare const channel: Channel;\ndeclare const spekeRole: iam.IRole;\n\nnew OriginEndpoint(this, 'Endpoint', {\n channel,\n segment: Segment.cmaf({\n encryption: CmafEncryption.speke({\n method: CmafEncryptionMethod.CBCS,\n drmSystems: [CmafDrmSystem.FAIRPLAY],\n resourceId: 'my-content-id',\n url: 'https://example.com/speke',\n role: spekeRole,\n excludeSegmentDrmMetadata: true,\n }),\n }),\n manifests: [Manifest.hls({ manifestName: 'index' })],\n});\n```\n\n### ISM (Smooth Streaming) Encryption\n\nISM endpoints use CENC encryption with PlayReady. Audio and video presets are always `SHARED`, and key rotation is not supported. The DRM system defaults to PlayReady:\n\n```ts\ndeclare const channel: Channel;\ndeclare const spekeRole: iam.IRole;\n\nnew OriginEndpoint(this, 'IsmEndpoint', {\n channel,\n segment: Segment.ism({\n encryption: IsmEncryption.speke({\n resourceId: 'my-content-id',\n url: 'https://example.com/speke',\n role: spekeRole,\n }),\n }),\n manifests: [Manifest.mss({ manifestName: 'index' })],\n});\n```\n\n## CloudWatch Metrics\n\nMediaPackage V2 resources expose CloudWatch metrics for monitoring. You can create alarms and dashboards using these metrics:\n\n```ts\ndeclare const channelGroup: ChannelGroup;\ndeclare const channel: Channel;\ndeclare const endpoint: OriginEndpoint;\n\n// Create a CloudWatch alarm on channel group egress bytes\nconst alarm = channelGroup.metricEgressBytes().createAlarm(this, 'HighEgress', {\n threshold: 1000,\n evaluationPeriods: 1,\n});\n\n// Monitor channel ingress response time\nchannel.metricIngressResponseTime().createAlarm(this, 'SlowIngress', {\n threshold: 1000,\n evaluationPeriods: 2,\n});\n\n// Track origin endpoint request count\nconst requestMetric = endpoint.metricEgressRequestCount({\n statistic: 'sum',\n period: Duration.minutes(5),\n});\n```\n\nAvailable metrics include:\n\n- `metricIngressBytes()` - Bytes ingested\n- `metricEgressBytes()` - Bytes delivered\n- `metricIngressResponseTime()` - Ingress response time (average)\n- `metricEgressResponseTime()` - Egress response time (average)\n- `metricIngressRequestCount()` - Number of ingress requests\n- `metricEgressRequestCount()` - Number of egress requests\n\nAll metrics support standard CloudWatch metric options for customizing period, statistic, and dimensions.\n"
|
|
8962
|
+
"markdown": "# AWS::MediaPackageV2 Construct Library\n<!--BEGIN STABILITY BANNER-->\n\n---\n\n\n\n> The APIs of higher level constructs in this module are experimental and under active development.\n> They are subject to non-backward compatible changes or removal in any future version. These are\n> not subject to the [Semantic Versioning](https://semver.org/) model and breaking changes will be\n> announced in the release notes. This means that while you may use them, you may need to update\n> your source code when upgrading to a newer version of this package.\n\n---\n\n<!--END STABILITY BANNER-->\n\n## AWS Elemental MediaPackage V2\n\nMediaPackage delivers high-quality video without concern for capacity and makes it easier to implement popular DVR features such as start over, pause, and rewind. Your content will be protected with comprehensive support for DRM. The service seamlessly integrates with other AWS media services as a complete set of tools for cloud-based video processing and delivery.\n\nThis package contains constructs for working with AWS Elemental MediaPackage V2. Allowing you to define AWS Elemental MediaPackage V2 Channel Groups, Channels, Origin Endpoints, Channel Policies and Origin Endpoint Policies.\n\nFor further information on AWS Elemental MediaPackage V2, see [the documentation](https://aws.amazon.com/mediapackage/).\n\nThe following example creates an AWS Elemental MediaPackage V2 Channel Group, Channel and Origin Endpoint:\n\n```ts\ndeclare const stack: Stack;\nconst group = new ChannelGroup(stack, 'MyChannelGroup', {\n channelGroupName: 'my-test-channel-group',\n});\n\nconst channel = new Channel(stack, 'MyChannel', {\n channelGroup: group,\n channelName: 'my-testchannel',\n input: InputConfiguration.cmaf(),\n});\n\nconst endpoint = new OriginEndpoint(stack, 'MyOriginEndpoint', {\n channel,\n originEndpointName: 'my-test-endpoint',\n segment: Segment.cmaf(),\n manifests: [Manifest.hls({\n manifestName: 'index',\n })],\n});\n```\n\n## Using Factory Methods\n\n```ts\ndeclare const stack: Stack;\n\n// Create a channel group\nconst group = new ChannelGroup(stack, 'MyChannelGroup', {\n channelGroupName: 'my-channel-group',\n});\n\n// Add a channel using the factory method\nconst channel = group.addChannel('MyChannel', {\n channelName: 'my-channel',\n input: InputConfiguration.cmaf(),\n});\n\n// Add an origin endpoint using the factory method\nconst endpoint = channel.addOriginEndpoint('MyEndpoint', {\n originEndpointName: 'my-endpoint',\n segment: Segment.cmaf(),\n manifests: [Manifest.hls({ manifestName: 'index' })],\n});\n```\n\n## Channel Group\n\nA channel group is the top-level resource that consists of channels and origin endpoints associated with it.\n\nThe following code creates a Channel Group:\n\n```ts\ndeclare const stack: Stack;\nconst group = new ChannelGroup(stack, 'MyChannelGroup', {\n channelGroupName: 'my-test-channel-group',\n});\n```\n\nThe following code imports an existing channel group using the name attribute:\n\n```ts\ndeclare const stack: Stack;\nconst channelGroup = ChannelGroup.fromChannelGroupAttributes(stack, 'ImportedChannelGroup', {\n channelGroupName: 'MyChannelGroup',\n});\n```\n\nYou can also import from an ARN, which automatically extracts the name and region:\n\n```ts\ndeclare const stack: Stack;\nconst channelGroup = ChannelGroup.fromChannelGroupArn(stack, 'ImportedChannelGroup',\n 'arn:aws:mediapackagev2:us-west-2:123456789012:channelGroup/MyChannelGroup',\n);\n```\n\nFor cross-region imports, pass the `region` parameter to ensure the correct ARN is constructed:\n\n```ts\ndeclare const stack: Stack;\nconst channelGroup = ChannelGroup.fromChannelGroupAttributes(stack, 'ImportedChannelGroup', {\n channelGroupName: 'MyChannelGroup',\n region: 'us-west-2',\n});\n```\n\n## Channel\n\nA channel is part of a channel group and represents the entry point for a content stream into MediaPackage.\n\n### Input Configuration\n\nChannels support two input types: HLS and CMAF.\n\n```ts\ndeclare const stack: Stack;\ndeclare const group: ChannelGroup;\n\nconst hlsChannel = new Channel(stack, 'HlsChannel', {\n channelGroup: group,\n input: InputConfiguration.hls(),\n});\n\nconst cmafChannel = new Channel(stack, 'CmafChannel', {\n channelGroup: group,\n input: InputConfiguration.cmaf({\n inputSwitchConfiguration: {\n mqcsInputSwitching: true,\n },\n outputHeaders: [HeadersCMSD.MQCS],\n }),\n});\n\nconst simpleCmafChannel = new Channel(stack, 'SimpleCmafChannel', {\n channelGroup: group,\n input: InputConfiguration.cmaf({\n outputHeaders: [HeadersCMSD.MQCS],\n }),\n});\n```\n\n### Importing an Existing Channel\n\nThe following code imports an existing channel using the name attributes:\n\n```ts\ndeclare const stack: Stack;\nconst channel = Channel.fromChannelAttributes(stack, 'ImportedChannel', {\n channelName: 'MyChannel',\n channelGroupName: 'MyChannelGroup',\n});\n```\n\nYou can also import from an ARN:\n\n```ts\ndeclare const stack: Stack;\nconst channel = Channel.fromChannelArn(stack, 'ImportedChannel',\n 'arn:aws:mediapackagev2:us-west-2:123456789012:channelGroup/MyGroup/channel/MyChannel',\n);\n```\n\nImported channels expose a `region` property, which is parsed from the ARN or falls back to the importing stack's region.\n\n### Channel Resource Policy\n\nThe following code creates a resource policy directly on the channel. This\nwill automatically create a policy on the first call:\n\n```ts\ndeclare const channel: Channel;\nchannel.addToResourcePolicy(new PolicyStatement({\n sid: 'AllowMediaLiveRoleToAccessEmpChannel',\n principals: [new ArnPrincipal('arn:aws:iam::AccountID:role/MediaLiveAccessRole')],\n effect: Effect.ALLOW,\n actions: ['mediapackagev2:PutObject'],\n resources: [channel.channelArn],\n}));\n```\n\n## Origin Endpoint\n\n```ts\ndeclare const stack: Stack;\ndeclare const channel: Channel;\nnew OriginEndpoint(stack, 'myendpoint', {\n channel,\n originEndpointName: 'my-test-endpoint',\n segment: Segment.cmaf(),\n manifests: [\n Manifest.hls({\n manifestName: 'index',\n }),\n ],\n});\n```\n\nThe following code imports an existing origin endpoint using the name attributes:\n\n```ts\ndeclare const stack: Stack;\nconst originEndpoint = OriginEndpoint.fromOriginEndpointAttributes(stack, 'ImportedOriginEndpoint', {\n channelGroupName: 'MyChannelGroup',\n channelName: 'MyChannel',\n originEndpointName: 'MyExampleOriginEndpoint',\n});\n```\n\nYou can also import from an ARN:\n\n```ts\ndeclare const stack: Stack;\nconst originEndpoint = OriginEndpoint.fromOriginEndpointArn(stack, 'ImportedOriginEndpoint',\n 'arn:aws:mediapackagev2:us-west-2:123456789012:channelGroup/MyGroup/channel/MyChannel/originEndpoint/MyEndpoint',\n);\n```\n\nThe following code creates a resource policy on the origin endpoint. This\nwill automatically create a policy on the first call:\n\n```ts\ndeclare const origin: OriginEndpoint;\n\norigin.addToResourcePolicy(new PolicyStatement({\n sid: 'AllowRequestsFromCloudFront',\n principals: [new ServicePrincipal('cloudfront.amazonaws.com')],\n effect: Effect.ALLOW,\n actions: ['mediapackagev2:GetHeadObject', 'mediapackagev2:GetObject'],\n resources: [origin.originEndpointArn],\n conditions: {\n StringEquals: {\n 'aws:SourceArn': 'arn:aws:cloudfront::123456789012:distribution/AAAAAAAAA',\n },\n },\n}));\n```\n\n## Granting Permissions\n\n### Granting Ingest Access to MediaLive\n\nTo allow AWS Elemental MediaLive to ingest content into a MediaPackage channel, use the `grants.ingest()` method:\n\n```ts\ndeclare const channel: Channel;\ndeclare const mediaLiveRole: iam.IRole;\n\n// Grant MediaLive permission to ingest content\nchannel.grants.ingest(mediaLiveRole);\n```\n\n### CloudFront Integration\n\nMediaPackage origin endpoints are designed to be used with Content Delivery Network (CDN) like Amazon CloudFront distributions. CloudFront provides caching, DDoS protection, and global content delivery for your streaming content.\n\nThe simplest way to connect CloudFront to a MediaPackage V2 endpoint is with `MediaPackageV2Origin`, which automatically creates an Origin Access Control (OAC) and wires the endpoint policy:\n\n```ts\ndeclare const endpoint: OriginEndpoint;\ndeclare const group: ChannelGroup;\n\nnew cloudfront.Distribution(this, 'Distribution', {\n defaultBehavior: {\n origin: new MediaPackageV2Origin(endpoint, {\n channelGroup: group,\n }),\n },\n});\n```\n\nThis handles OAC creation, HTTPS-only origin config, and the IAM policy granting CloudFront access to the endpoint (including `GetHeadObject` for MQAR support).\n\nFor more control, you can manually configure the policy and OAC:\n\n```ts\ndeclare const originEndpoint: OriginEndpoint;\ndeclare const distribution: cloudfront.Distribution;\n\noriginEndpoint.addToResourcePolicy(new iam.PolicyStatement({\n sid: 'AllowCloudFrontServicePrincipal',\n principals: [new iam.ServicePrincipal('cloudfront.amazonaws.com')],\n effect: iam.Effect.ALLOW,\n actions: ['mediapackagev2:GetObject', 'mediapackagev2:GetHeadObject'],\n resources: [originEndpoint.originEndpointArn],\n conditions: {\n StringEquals: {\n 'aws:SourceArn': distribution.distributionArn,\n },\n },\n}));\n```\n\n> **Graduation plan:** `MediaPackageV2Origin` currently lives in this alpha module. When MediaPackage V2 graduates to stable, it will move to `aws-cloudfront-origins` alongside `S3BucketOrigin` and other origin helpers.\n\n## Manifest Configuration\n\nMediaPackage V2 supports multiple manifest formats: HLS, Low-Latency HLS (LL-HLS), DASH, and Microsoft Smooth Streaming (MSS).\n\n### HLS Manifests\n\n```ts\ndeclare const channel: Channel;\n\nnew OriginEndpoint(this, 'Endpoint', {\n channel,\n segment: Segment.cmaf(),\n manifests: [\n Manifest.hls({\n manifestName: 'index',\n manifestWindow: Duration.seconds(60),\n programDateTimeInterval: Duration.seconds(60),\n scteAdMarkerHls: AdMarkerHls.DATERANGE,\n }),\n ],\n});\n```\n\n### Low-Latency HLS Manifests\n\n```ts\ndeclare const channel: Channel;\n\nnew OriginEndpoint(this, 'Endpoint', {\n channel,\n segment: Segment.cmaf(),\n manifests: [\n Manifest.lowLatencyHLS({\n manifestName: 'index',\n manifestWindow: Duration.seconds(30),\n programDateTimeInterval: Duration.seconds(5),\n childManifestName: 'child',\n }),\n ],\n});\n```\n\n### DASH Manifests\n\n```ts\ndeclare const channel: Channel;\n\nnew OriginEndpoint(this, 'Endpoint', {\n channel,\n segment: Segment.cmaf(),\n manifests: [\n Manifest.dash({\n manifestName: 'index',\n manifestWindow: Duration.seconds(60),\n minBufferTime: Duration.seconds(30),\n minUpdatePeriod: Duration.seconds(10),\n segmentTemplateFormat: SegmentTemplateFormat.NUMBER_WITH_TIMELINE,\n periodTriggers: [\n DashPeriodTriggers.AVAILS,\n DashPeriodTriggers.DRM_KEY_ROTATION,\n ],\n }),\n ],\n});\n```\n\n### MSS Manifests\n\n```ts\ndeclare const channel: Channel;\n\nnew OriginEndpoint(this, 'Endpoint', {\n channel,\n segment: Segment.ism(),\n manifests: [\n Manifest.mss({\n manifestName: 'index',\n manifestWindow: Duration.seconds(60),\n manifestLayout: MssManifestLayout.COMPACT,\n }),\n ],\n});\n```\n\n### Multiple Manifests\n\nYou can configure multiple manifest formats for a single origin endpoint:\n\n```ts\ndeclare const channel: Channel;\n\nnew OriginEndpoint(this, 'Endpoint', {\n channel,\n segment: Segment.cmaf(),\n manifests: [\n Manifest.hls({ manifestName: 'hls' }),\n Manifest.dash({ manifestName: 'dash' }),\n ],\n});\n```\n\n| Segment type | Supported manifests |\n|--------|--------|\n| Segment.cmaf() | HLS, LL-HLS, DASH |\n| Segment.ts() | HLS, LL-HLS |\n| Segment.ism() | MSS |\n\nEach origin endpoint has a single segment configuration. If you need segments with different configurations, use multiple origin endpoints on the same channel.\n\n@see https://docs.aws.amazon.com/mediapackage/latest/userguide/endpoints-create.html\n\n## Manifest Filtering\n\nManifest filters control which variants are included in the manifest. Filters are type-safe and validated against the [MediaPackage manifest filtering rules](https://docs.aws.amazon.com/mediapackage/latest/userguide/manifest-filter-query-parameters.html).\n\n| Filter | Method |\n|--------|--------|\n| Audio / video bitrate | `bitrate()`, `bitrateRange()`, `bitrateCombo()` |\n| Audio channels, sample rate, video height, framerate, trickplay height | `numeric()`, `numericList()`, `numericRange()`, `numericCombo()` |\n| Audio codec | `audioCodec()`, `audioCodecList()` |\n| Video codec | `videoCodec()`, `videoCodecList()` |\n| Video dynamic range | `videoDynamicRange()`, `videoDynamicRangeList()` |\n| Trickplay type | `trickplayType()`, `trickplayTypeList()` |\n| Audio / subtitle language | `text()`, `textList()` |\n| Advanced patterns | `custom()` |\n\nThe following example creates an HD streaming endpoint that serves only H.264/H.265 content between 1–5 Mbps with stereo audio in English or French:\n\n```ts\ndeclare const channel: Channel;\n\nnew OriginEndpoint(this, 'Endpoint', {\n channel,\n segment: Segment.cmaf(),\n manifests: [\n Manifest.hls({\n manifestName: 'index',\n filterConfiguration: {\n manifestFilter: [\n ManifestFilter.bitrateRange(BitrateFilterKey.VIDEO_BITRATE, Bitrate.mbps(1), Bitrate.mbps(5)),\n ManifestFilter.numericRange(NumericFilterKey.VIDEO_HEIGHT, 720, 1080),\n ManifestFilter.videoCodecList([VideoCodec.H264, VideoCodec.H265]),\n ManifestFilter.numeric(NumericFilterKey.AUDIO_CHANNELS, 2),\n ManifestFilter.textList(TextFilterKey.AUDIO_LANGUAGE, ['en-US', 'fr']),\n ],\n timeDelay: Duration.seconds(30),\n },\n }),\n ],\n});\n```\n\nFor advanced patterns that combine ranges and single values, use `numericCombo()` or `bitrateCombo()`:\n\n```ts\ndeclare const channel: Channel;\n\nnew OriginEndpoint(this, 'Endpoint', {\n channel,\n segment: Segment.cmaf(),\n manifests: [\n Manifest.hls({\n manifestName: 'index',\n filterConfiguration: {\n manifestFilter: [\n // video_height:240-360,720-1080,1440\n ManifestFilter.numericCombo(NumericFilterKey.VIDEO_HEIGHT, [\n NumericExpression.range(240, 360),\n NumericExpression.range(720, 1080),\n NumericExpression.value(1440),\n ]),\n ],\n },\n }),\n ],\n});\n```\n\n### DRM Settings\n\nYou can exclude session keys from HLS and LL-HLS multivariant playlists using the `drmSettings` filter configuration. This improves compatibility with legacy HLS clients and provides more granular access control:\n\n```ts\ndeclare const channel: Channel;\n\nnew OriginEndpoint(this, 'Endpoint', {\n channel,\n segment: Segment.cmaf(),\n manifests: [\n Manifest.hls({\n manifestName: 'index',\n filterConfiguration: {\n drmSettings: [DrmSettingsKey.EXCLUDE_SESSION_KEYS],\n },\n }),\n ],\n});\n```\n\n## Start Tag Configuration\n\nConfigure where playback should start in HLS and LL-HLS manifests using the EXT-X-START tag:\n\n```ts\ndeclare const channel: Channel;\n\nnew OriginEndpoint(this, 'Endpoint', {\n channel,\n segment: Segment.cmaf(),\n manifests: [\n Manifest.hls({\n manifestName: 'index',\n startTag: StartTag.of(10),\n }),\n ],\n});\n```\n\n## Segment Configuration\n\nConfigure segment settings for your origin endpoint.\n\n```ts\ndeclare const channel: Channel;\n\nnew OriginEndpoint(this, 'TsEndpoint', {\n channel,\n segment: Segment.ts({\n duration: Duration.seconds(6),\n name: 'segment',\n includeDvbSubtitles: true,\n useAudioRenditionGroup: true,\n includeIframeOnlyStreams: false,\n scteFilter: [\n ScteMessageType.BREAK,\n ScteMessageType.DISTRIBUTOR_ADVERTISEMENT,\n ],\n }),\n manifests: [Manifest.hls({ manifestName: 'index' })],\n});\n\nnew OriginEndpoint(this, 'CmafEndpoint', {\n channel,\n segment: Segment.cmaf({\n duration: Duration.seconds(6),\n name: 'segment',\n includeIframeOnlyStreams: true,\n scteFilter: [ScteMessageType.DISTRIBUTOR_ADVERTISEMENT],\n }),\n manifests: [Manifest.hls({ manifestName: 'index' })],\n});\n\nnew OriginEndpoint(this, 'Endpoint', {\n channel,\n segment: Segment.cmaf(),\n manifests: [Manifest.hls({ manifestName: 'index' })],\n});\n```\n\n## Encryption and DRM\n\nProtect your content with encryption using SPEKE (Secure Packager and Encoder Key Exchange). Each container type has its own encryption class with type-safe options:\n\n### CMAF Encryption\n\n```ts\ndeclare const channel: Channel;\ndeclare const spekeRole: iam.IRole;\n\nnew OriginEndpoint(this, 'Endpoint', {\n channel,\n segment: Segment.cmaf({\n encryption: CmafEncryption.speke({\n method: CmafEncryptionMethod.CBCS,\n drmSystems: [CmafDrmSystem.FAIRPLAY, CmafDrmSystem.WIDEVINE],\n resourceId: 'my-content-id',\n url: 'https://example.com/speke',\n role: spekeRole,\n keyRotationInterval: Duration.seconds(300),\n audioPreset: PresetSpeke20Audio.PRESET_AUDIO_2,\n videoPreset: PresetSpeke20Video.PRESET_VIDEO_2,\n }),\n }),\n manifests: [Manifest.hls({ manifestName: 'index' })],\n});\n```\n\n### TS Encryption\n\n```ts\ndeclare const channel: Channel;\ndeclare const spekeRole: iam.IRole;\n\nnew OriginEndpoint(this, 'TsEndpoint', {\n channel,\n segment: Segment.ts({\n encryption: TsEncryption.speke({\n method: TsEncryptionMethod.SAMPLE_AES,\n resourceId: 'my-content-id',\n url: 'https://example.com/speke',\n role: spekeRole,\n }),\n }),\n manifests: [Manifest.hls({ manifestName: 'index' })],\n});\n```\n\nTS encryption defaults the DRM system based on the method: FairPlay for `SAMPLE_AES`, Clear Key AES 128 for `AES_128`. You can override this with the `drmSystems` property using `TsDrmSystem`.\n\n### Content Key Encryption\n\nYou can add content key encryption by providing a certificate imported into AWS Certificate Manager. Your DRM key provider must support content key encryption for this to work:\n\n```ts\ndeclare const channel: Channel;\ndeclare const spekeRole: iam.IRole;\ndeclare const certificate: certificatemanager.ICertificate;\n\nnew OriginEndpoint(this, 'Endpoint', {\n channel,\n segment: Segment.cmaf({\n encryption: CmafEncryption.speke({\n method: CmafEncryptionMethod.CBCS,\n drmSystems: [CmafDrmSystem.FAIRPLAY],\n resourceId: 'my-content-id',\n url: 'https://example.com/speke',\n role: spekeRole,\n certificate,\n }),\n }),\n manifests: [Manifest.hls({ manifestName: 'index' })],\n});\n```\n\n### Excluding Segment DRM Metadata\n\nFor CMAF content, you can exclude DRM metadata from segments:\n\n```ts\ndeclare const channel: Channel;\ndeclare const spekeRole: iam.IRole;\n\nnew OriginEndpoint(this, 'Endpoint', {\n channel,\n segment: Segment.cmaf({\n encryption: CmafEncryption.speke({\n method: CmafEncryptionMethod.CBCS,\n drmSystems: [CmafDrmSystem.FAIRPLAY],\n resourceId: 'my-content-id',\n url: 'https://example.com/speke',\n role: spekeRole,\n excludeSegmentDrmMetadata: true,\n }),\n }),\n manifests: [Manifest.hls({ manifestName: 'index' })],\n});\n```\n\n### ISM (Smooth Streaming) Encryption\n\nISM endpoints use CENC encryption with PlayReady. Audio and video presets are always `SHARED`, and key rotation is not supported. The DRM system defaults to PlayReady:\n\n```ts\ndeclare const channel: Channel;\ndeclare const spekeRole: iam.IRole;\n\nnew OriginEndpoint(this, 'IsmEndpoint', {\n channel,\n segment: Segment.ism({\n encryption: IsmEncryption.speke({\n resourceId: 'my-content-id',\n url: 'https://example.com/speke',\n role: spekeRole,\n }),\n }),\n manifests: [Manifest.mss({ manifestName: 'index' })],\n});\n```\n\n## CloudWatch Metrics\n\nMediaPackage V2 resources expose CloudWatch metrics for monitoring. You can create alarms and dashboards using these metrics:\n\n```ts\ndeclare const channelGroup: ChannelGroup;\ndeclare const channel: Channel;\ndeclare const endpoint: OriginEndpoint;\n\n// Create a CloudWatch alarm on channel group egress bytes\nconst alarm = channelGroup.metricEgressBytes().createAlarm(this, 'HighEgress', {\n threshold: 1000,\n evaluationPeriods: 1,\n});\n\n// Monitor channel ingress response time\nchannel.metricIngressResponseTime().createAlarm(this, 'SlowIngress', {\n threshold: 1000,\n evaluationPeriods: 2,\n});\n\n// Track origin endpoint request count\nconst requestMetric = endpoint.metricEgressRequestCount({\n statistic: 'sum',\n period: Duration.minutes(5),\n});\n```\n\nAvailable metrics include:\n\n- `metricIngressBytes()` - Bytes ingested\n- `metricEgressBytes()` - Bytes delivered\n- `metricIngressResponseTime()` - Ingress response time (average)\n- `metricEgressResponseTime()` - Egress response time (average)\n- `metricIngressRequestCount()` - Number of ingress requests\n- `metricEgressRequestCount()` - Number of egress requests\n\nAll metrics support standard CloudWatch metric options for customizing period, statistic, and dimensions.\n"
|
|
8963
8963
|
},
|
|
8964
8964
|
"repository": {
|
|
8965
8965
|
"directory": "packages/@aws-cdk/aws-mediapackagev2-alpha",
|
|
@@ -15841,6 +15841,179 @@
|
|
|
15841
15841
|
],
|
|
15842
15842
|
"symbolId": "lib/endpoint:ManifestFilter"
|
|
15843
15843
|
},
|
|
15844
|
+
"@aws-cdk/aws-mediapackagev2-alpha.MediaPackageV2Origin": {
|
|
15845
|
+
"assembly": "@aws-cdk/aws-mediapackagev2-alpha",
|
|
15846
|
+
"base": "aws-cdk-lib.aws_cloudfront.OriginBase",
|
|
15847
|
+
"docs": {
|
|
15848
|
+
"example": " declare const endpoint: OriginEndpoint;\n declare const group: ChannelGroup;\n\n new cloudfront.Distribution(this, 'Dist', {\n defaultBehavior: {\n origin: new MediaPackageV2Origin(endpoint, {\n channelGroup: group,\n }),\n },\n });",
|
|
15849
|
+
"remarks": "Automatically creates an OAC and wires the origin endpoint policy\nto grant the CloudFront distribution access.\n\nUses `addToResourcePolicy()` on the origin endpoint, which is compatible\nwith other policy statements added to the same endpoint. Do not use this\nalongside a manually created `OriginEndpointPolicy` construct for the same endpoint.",
|
|
15850
|
+
"see": "https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-restricting-access-to-mediapackage.html",
|
|
15851
|
+
"stability": "experimental",
|
|
15852
|
+
"summary": "A CloudFront Origin for AWS Elemental MediaPackage V2 endpoints."
|
|
15853
|
+
},
|
|
15854
|
+
"fqn": "@aws-cdk/aws-mediapackagev2-alpha.MediaPackageV2Origin",
|
|
15855
|
+
"initializer": {
|
|
15856
|
+
"docs": {
|
|
15857
|
+
"stability": "experimental"
|
|
15858
|
+
},
|
|
15859
|
+
"locationInModule": {
|
|
15860
|
+
"filename": "lib/cloudfront-origin.ts",
|
|
15861
|
+
"line": 71
|
|
15862
|
+
},
|
|
15863
|
+
"parameters": [
|
|
15864
|
+
{
|
|
15865
|
+
"name": "endpoint",
|
|
15866
|
+
"type": {
|
|
15867
|
+
"fqn": "@aws-cdk/aws-mediapackagev2-alpha.IOriginEndpoint"
|
|
15868
|
+
}
|
|
15869
|
+
},
|
|
15870
|
+
{
|
|
15871
|
+
"name": "props",
|
|
15872
|
+
"type": {
|
|
15873
|
+
"fqn": "@aws-cdk/aws-mediapackagev2-alpha.MediaPackageV2OriginProps"
|
|
15874
|
+
}
|
|
15875
|
+
}
|
|
15876
|
+
]
|
|
15877
|
+
},
|
|
15878
|
+
"kind": "class",
|
|
15879
|
+
"locationInModule": {
|
|
15880
|
+
"filename": "lib/cloudfront-origin.ts",
|
|
15881
|
+
"line": 66
|
|
15882
|
+
},
|
|
15883
|
+
"methods": [
|
|
15884
|
+
{
|
|
15885
|
+
"docs": {
|
|
15886
|
+
"remarks": "Can be used to grant permissions, create dependent resources, etc.",
|
|
15887
|
+
"stability": "experimental",
|
|
15888
|
+
"summary": "Binds the origin to the associated Distribution."
|
|
15889
|
+
},
|
|
15890
|
+
"locationInModule": {
|
|
15891
|
+
"filename": "lib/cloudfront-origin.ts",
|
|
15892
|
+
"line": 91
|
|
15893
|
+
},
|
|
15894
|
+
"name": "bind",
|
|
15895
|
+
"overrides": "aws-cdk-lib.aws_cloudfront.OriginBase",
|
|
15896
|
+
"parameters": [
|
|
15897
|
+
{
|
|
15898
|
+
"name": "scope",
|
|
15899
|
+
"type": {
|
|
15900
|
+
"fqn": "constructs.Construct"
|
|
15901
|
+
}
|
|
15902
|
+
},
|
|
15903
|
+
{
|
|
15904
|
+
"name": "options",
|
|
15905
|
+
"type": {
|
|
15906
|
+
"fqn": "aws-cdk-lib.aws_cloudfront.OriginBindOptions"
|
|
15907
|
+
}
|
|
15908
|
+
}
|
|
15909
|
+
],
|
|
15910
|
+
"returns": {
|
|
15911
|
+
"type": {
|
|
15912
|
+
"fqn": "aws-cdk-lib.aws_cloudfront.OriginBindConfig"
|
|
15913
|
+
}
|
|
15914
|
+
}
|
|
15915
|
+
},
|
|
15916
|
+
{
|
|
15917
|
+
"docs": {
|
|
15918
|
+
"stability": "experimental"
|
|
15919
|
+
},
|
|
15920
|
+
"locationInModule": {
|
|
15921
|
+
"filename": "lib/cloudfront-origin.ts",
|
|
15922
|
+
"line": 84
|
|
15923
|
+
},
|
|
15924
|
+
"name": "renderCustomOriginConfig",
|
|
15925
|
+
"overrides": "aws-cdk-lib.aws_cloudfront.OriginBase",
|
|
15926
|
+
"protected": true,
|
|
15927
|
+
"returns": {
|
|
15928
|
+
"optional": true,
|
|
15929
|
+
"type": {
|
|
15930
|
+
"fqn": "aws-cdk-lib.aws_cloudfront.CfnDistribution.CustomOriginConfigProperty"
|
|
15931
|
+
}
|
|
15932
|
+
}
|
|
15933
|
+
}
|
|
15934
|
+
],
|
|
15935
|
+
"name": "MediaPackageV2Origin",
|
|
15936
|
+
"symbolId": "lib/cloudfront-origin:MediaPackageV2Origin"
|
|
15937
|
+
},
|
|
15938
|
+
"@aws-cdk/aws-mediapackagev2-alpha.MediaPackageV2OriginProps": {
|
|
15939
|
+
"assembly": "@aws-cdk/aws-mediapackagev2-alpha",
|
|
15940
|
+
"datatype": true,
|
|
15941
|
+
"docs": {
|
|
15942
|
+
"stability": "experimental",
|
|
15943
|
+
"summary": "Properties for a MediaPackage V2 Origin with OAC.",
|
|
15944
|
+
"example": "declare const endpoint: OriginEndpoint;\ndeclare const group: ChannelGroup;\n\nnew cloudfront.Distribution(this, 'Distribution', {\n defaultBehavior: {\n origin: new MediaPackageV2Origin(endpoint, {\n channelGroup: group,\n }),\n },\n});",
|
|
15945
|
+
"custom": {
|
|
15946
|
+
"exampleMetadata": "infused"
|
|
15947
|
+
}
|
|
15948
|
+
},
|
|
15949
|
+
"fqn": "@aws-cdk/aws-mediapackagev2-alpha.MediaPackageV2OriginProps",
|
|
15950
|
+
"interfaces": [
|
|
15951
|
+
"aws-cdk-lib.aws_cloudfront.OriginProps"
|
|
15952
|
+
],
|
|
15953
|
+
"kind": "interface",
|
|
15954
|
+
"locationInModule": {
|
|
15955
|
+
"filename": "lib/cloudfront-origin.ts",
|
|
15956
|
+
"line": 14
|
|
15957
|
+
},
|
|
15958
|
+
"name": "MediaPackageV2OriginProps",
|
|
15959
|
+
"properties": [
|
|
15960
|
+
{
|
|
15961
|
+
"abstract": true,
|
|
15962
|
+
"docs": {
|
|
15963
|
+
"remarks": "Used to derive the egress domain for the CloudFront origin.",
|
|
15964
|
+
"stability": "experimental",
|
|
15965
|
+
"summary": "The channel group that the origin endpoint belongs to."
|
|
15966
|
+
},
|
|
15967
|
+
"immutable": true,
|
|
15968
|
+
"locationInModule": {
|
|
15969
|
+
"filename": "lib/cloudfront-origin.ts",
|
|
15970
|
+
"line": 20
|
|
15971
|
+
},
|
|
15972
|
+
"name": "channelGroup",
|
|
15973
|
+
"type": {
|
|
15974
|
+
"fqn": "@aws-cdk/aws-mediapackagev2-alpha.IChannelGroup"
|
|
15975
|
+
}
|
|
15976
|
+
},
|
|
15977
|
+
{
|
|
15978
|
+
"abstract": true,
|
|
15979
|
+
"docs": {
|
|
15980
|
+
"default": "- no CDN authorization",
|
|
15981
|
+
"remarks": "If you need CDN auth on this endpoint, provide it here so it is configured\non the first `addToResourcePolicy` call. If CDN auth is added separately\nafter this origin is bound, it will be ignored.",
|
|
15982
|
+
"stability": "experimental",
|
|
15983
|
+
"summary": "Optional CDN authorization configuration."
|
|
15984
|
+
},
|
|
15985
|
+
"immutable": true,
|
|
15986
|
+
"locationInModule": {
|
|
15987
|
+
"filename": "lib/cloudfront-origin.ts",
|
|
15988
|
+
"line": 38
|
|
15989
|
+
},
|
|
15990
|
+
"name": "cdnAuth",
|
|
15991
|
+
"optional": true,
|
|
15992
|
+
"type": {
|
|
15993
|
+
"fqn": "@aws-cdk/aws-mediapackagev2-alpha.CdnAuthConfiguration"
|
|
15994
|
+
}
|
|
15995
|
+
},
|
|
15996
|
+
{
|
|
15997
|
+
"abstract": true,
|
|
15998
|
+
"docs": {
|
|
15999
|
+
"default": "- an Origin Access Control will be created automatically.",
|
|
16000
|
+
"stability": "experimental",
|
|
16001
|
+
"summary": "An optional Origin Access Control."
|
|
16002
|
+
},
|
|
16003
|
+
"immutable": true,
|
|
16004
|
+
"locationInModule": {
|
|
16005
|
+
"filename": "lib/cloudfront-origin.ts",
|
|
16006
|
+
"line": 27
|
|
16007
|
+
},
|
|
16008
|
+
"name": "originAccessControl",
|
|
16009
|
+
"optional": true,
|
|
16010
|
+
"type": {
|
|
16011
|
+
"fqn": "aws-cdk-lib.interfaces.aws_cloudfront.IOriginAccessControlRef"
|
|
16012
|
+
}
|
|
16013
|
+
}
|
|
16014
|
+
],
|
|
16015
|
+
"symbolId": "lib/cloudfront-origin:MediaPackageV2OriginProps"
|
|
16016
|
+
},
|
|
15844
16017
|
"@aws-cdk/aws-mediapackagev2-alpha.MssManifestConfiguration": {
|
|
15845
16018
|
"assembly": "@aws-cdk/aws-mediapackagev2-alpha",
|
|
15846
16019
|
"datatype": true,
|
|
@@ -18851,6 +19024,6 @@
|
|
|
18851
19024
|
"symbolId": "lib/endpoint:VideoDynamicRange"
|
|
18852
19025
|
}
|
|
18853
19026
|
},
|
|
18854
|
-
"version": "2.
|
|
19027
|
+
"version": "2.255.0-alpha.0",
|
|
18855
19028
|
"fingerprint": "**********"
|
|
18856
19029
|
}
|
package/.jsii.tabl.json.gz
CHANGED
|
Binary file
|
package/.warnings.jsii.js
CHANGED
|
@@ -211,6 +211,17 @@ const VALIDATORS = { _aws_cdk_aws_mediapackagev2_alpha_FilterConfiguration: func
|
|
|
211
211
|
finally {
|
|
212
212
|
visitedObjects.delete(p);
|
|
213
213
|
}
|
|
214
|
+
}, _aws_cdk_aws_mediapackagev2_alpha_MediaPackageV2OriginProps: function _aws_cdk_aws_mediapackagev2_alpha_MediaPackageV2OriginProps(p) {
|
|
215
|
+
if (p == null)
|
|
216
|
+
return;
|
|
217
|
+
visitedObjects.add(p);
|
|
218
|
+
try {
|
|
219
|
+
if (!visitedObjects.has(p.cdnAuth))
|
|
220
|
+
module.exports._aws_cdk_aws_mediapackagev2_alpha_CdnAuthConfiguration(p.cdnAuth);
|
|
221
|
+
}
|
|
222
|
+
finally {
|
|
223
|
+
visitedObjects.delete(p);
|
|
224
|
+
}
|
|
214
225
|
} };
|
|
215
226
|
function print(name, deprecationMessage) {
|
|
216
227
|
const deprecated = process.env.JSII_DEPRECATED;
|
package/README.md
CHANGED
|
@@ -261,7 +261,24 @@ channel.grants.ingest(mediaLiveRole);
|
|
|
261
261
|
|
|
262
262
|
MediaPackage origin endpoints are designed to be used with Content Delivery Network (CDN) like Amazon CloudFront distributions. CloudFront provides caching, DDoS protection, and global content delivery for your streaming content.
|
|
263
263
|
|
|
264
|
-
|
|
264
|
+
The simplest way to connect CloudFront to a MediaPackage V2 endpoint is with `MediaPackageV2Origin`, which automatically creates an Origin Access Control (OAC) and wires the endpoint policy:
|
|
265
|
+
|
|
266
|
+
```ts
|
|
267
|
+
declare const endpoint: OriginEndpoint;
|
|
268
|
+
declare const group: ChannelGroup;
|
|
269
|
+
|
|
270
|
+
new cloudfront.Distribution(this, 'Distribution', {
|
|
271
|
+
defaultBehavior: {
|
|
272
|
+
origin: new MediaPackageV2Origin(endpoint, {
|
|
273
|
+
channelGroup: group,
|
|
274
|
+
}),
|
|
275
|
+
},
|
|
276
|
+
});
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
This handles OAC creation, HTTPS-only origin config, and the IAM policy granting CloudFront access to the endpoint (including `GetHeadObject` for MQAR support).
|
|
280
|
+
|
|
281
|
+
For more control, you can manually configure the policy and OAC:
|
|
265
282
|
|
|
266
283
|
```ts
|
|
267
284
|
declare const originEndpoint: OriginEndpoint;
|
|
@@ -281,7 +298,7 @@ originEndpoint.addToResourcePolicy(new iam.PolicyStatement({
|
|
|
281
298
|
}));
|
|
282
299
|
```
|
|
283
300
|
|
|
284
|
-
|
|
301
|
+
> **Graduation plan:** `MediaPackageV2Origin` currently lives in this alpha module. When MediaPackage V2 graduates to stable, it will move to `aws-cloudfront-origins` alongside `S3BucketOrigin` and other origin helpers.
|
|
285
302
|
|
|
286
303
|
## Manifest Configuration
|
|
287
304
|
|
package/lib/channel-policy.js
CHANGED
|
@@ -76,7 +76,7 @@ let ChannelPolicy = (() => {
|
|
|
76
76
|
ChannelPolicy = _classThis = _classDescriptor.value;
|
|
77
77
|
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
78
78
|
}
|
|
79
|
-
static [JSII_RTTI_SYMBOL_1] = { fqn: "@aws-cdk/aws-mediapackagev2-alpha.ChannelPolicy", version: "2.
|
|
79
|
+
static [JSII_RTTI_SYMBOL_1] = { fqn: "@aws-cdk/aws-mediapackagev2-alpha.ChannelPolicy", version: "2.255.0-alpha.0" };
|
|
80
80
|
/** Uniquely identifies this class. */
|
|
81
81
|
static PROPERTY_INJECTION_ID = '@aws-cdk.aws-mediapackagev2-alpha.ChannelPolicy';
|
|
82
82
|
/**
|
package/lib/channel.js
CHANGED
|
@@ -80,7 +80,7 @@ var IngestEndpoint;
|
|
|
80
80
|
*/
|
|
81
81
|
class HeadersCMSD {
|
|
82
82
|
value;
|
|
83
|
-
static [JSII_RTTI_SYMBOL_1] = { fqn: "@aws-cdk/aws-mediapackagev2-alpha.HeadersCMSD", version: "2.
|
|
83
|
+
static [JSII_RTTI_SYMBOL_1] = { fqn: "@aws-cdk/aws-mediapackagev2-alpha.HeadersCMSD", version: "2.255.0-alpha.0" };
|
|
84
84
|
/**
|
|
85
85
|
* Media Quality Confidence Score
|
|
86
86
|
*/
|
|
@@ -111,7 +111,7 @@ class InputConfiguration {
|
|
|
111
111
|
inputType;
|
|
112
112
|
inputSwitchConfiguration;
|
|
113
113
|
outputHeaders;
|
|
114
|
-
static [JSII_RTTI_SYMBOL_1] = { fqn: "@aws-cdk/aws-mediapackagev2-alpha.InputConfiguration", version: "2.
|
|
114
|
+
static [JSII_RTTI_SYMBOL_1] = { fqn: "@aws-cdk/aws-mediapackagev2-alpha.InputConfiguration", version: "2.255.0-alpha.0" };
|
|
115
115
|
/**
|
|
116
116
|
* Create an HLS input configuration
|
|
117
117
|
*/
|
|
@@ -357,7 +357,7 @@ let Channel = (() => {
|
|
|
357
357
|
Channel = _classThis = _classDescriptor.value;
|
|
358
358
|
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
359
359
|
}
|
|
360
|
-
static [JSII_RTTI_SYMBOL_1] = { fqn: "@aws-cdk/aws-mediapackagev2-alpha.Channel", version: "2.
|
|
360
|
+
static [JSII_RTTI_SYMBOL_1] = { fqn: "@aws-cdk/aws-mediapackagev2-alpha.Channel", version: "2.255.0-alpha.0" };
|
|
361
361
|
/** Uniquely identifies this class. */
|
|
362
362
|
static PROPERTY_INJECTION_ID = '@aws-cdk.aws-mediapackagev2-alpha.Channel';
|
|
363
363
|
channelGroupName;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import * as cloudfront from 'aws-cdk-lib/aws-cloudfront';
|
|
2
|
+
import type { Construct } from 'constructs';
|
|
3
|
+
import type { IOriginEndpoint } from './endpoint';
|
|
4
|
+
import type { IChannelGroup } from './group';
|
|
5
|
+
import type { CdnAuthConfiguration } from './origin-endpoint-policy';
|
|
6
|
+
/**
|
|
7
|
+
* Properties for a MediaPackage V2 Origin with OAC.
|
|
8
|
+
*/
|
|
9
|
+
export interface MediaPackageV2OriginProps extends cloudfront.OriginProps {
|
|
10
|
+
/**
|
|
11
|
+
* The channel group that the origin endpoint belongs to.
|
|
12
|
+
*
|
|
13
|
+
* Used to derive the egress domain for the CloudFront origin.
|
|
14
|
+
*/
|
|
15
|
+
readonly channelGroup: IChannelGroup;
|
|
16
|
+
/**
|
|
17
|
+
* An optional Origin Access Control.
|
|
18
|
+
*
|
|
19
|
+
* @default - an Origin Access Control will be created automatically.
|
|
20
|
+
*/
|
|
21
|
+
readonly originAccessControl?: cloudfront.IOriginAccessControlRef;
|
|
22
|
+
/**
|
|
23
|
+
* Optional CDN authorization configuration.
|
|
24
|
+
*
|
|
25
|
+
* If you need CDN auth on this endpoint, provide it here so it is configured
|
|
26
|
+
* on the first `addToResourcePolicy` call. If CDN auth is added separately
|
|
27
|
+
* after this origin is bound, it will be ignored.
|
|
28
|
+
*
|
|
29
|
+
* @default - no CDN authorization
|
|
30
|
+
*/
|
|
31
|
+
readonly cdnAuth?: CdnAuthConfiguration;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* A CloudFront Origin for AWS Elemental MediaPackage V2 endpoints.
|
|
35
|
+
*
|
|
36
|
+
* Automatically creates an OAC and wires the origin endpoint policy
|
|
37
|
+
* to grant the CloudFront distribution access.
|
|
38
|
+
*
|
|
39
|
+
* Uses `addToResourcePolicy()` on the origin endpoint, which is compatible
|
|
40
|
+
* with other policy statements added to the same endpoint. Do not use this
|
|
41
|
+
* alongside a manually created `OriginEndpointPolicy` construct for the same endpoint.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
*
|
|
45
|
+
* declare const endpoint: OriginEndpoint;
|
|
46
|
+
* declare const group: ChannelGroup;
|
|
47
|
+
*
|
|
48
|
+
* new cloudfront.Distribution(this, 'Dist', {
|
|
49
|
+
* defaultBehavior: {
|
|
50
|
+
* origin: new MediaPackageV2Origin(endpoint, {
|
|
51
|
+
* channelGroup: group,
|
|
52
|
+
* }),
|
|
53
|
+
* },
|
|
54
|
+
* });
|
|
55
|
+
*
|
|
56
|
+
* @see https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-restricting-access-to-mediapackage.html
|
|
57
|
+
*/
|
|
58
|
+
export declare class MediaPackageV2Origin extends cloudfront.OriginBase {
|
|
59
|
+
private originAccessControl?;
|
|
60
|
+
private readonly endpoint;
|
|
61
|
+
private readonly cdnAuth?;
|
|
62
|
+
constructor(endpoint: IOriginEndpoint, props: MediaPackageV2OriginProps);
|
|
63
|
+
protected renderCustomOriginConfig(): cloudfront.CfnDistribution.CustomOriginConfigProperty | undefined;
|
|
64
|
+
bind(scope: Construct, options: cloudfront.OriginBindOptions): cloudfront.OriginBindConfig;
|
|
65
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MediaPackageV2Origin = void 0;
|
|
4
|
+
const jsiiDeprecationWarnings = require("../.warnings.jsii.js");
|
|
5
|
+
const JSII_RTTI_SYMBOL_1 = Symbol.for("jsii.rtti");
|
|
6
|
+
const cdk = require("aws-cdk-lib");
|
|
7
|
+
const cloudfront = require("aws-cdk-lib/aws-cloudfront");
|
|
8
|
+
const aws_iam_1 = require("aws-cdk-lib/aws-iam");
|
|
9
|
+
const core_1 = require("aws-cdk-lib/core");
|
|
10
|
+
const helpers_internal_1 = require("aws-cdk-lib/core/lib/helpers-internal");
|
|
11
|
+
/**
|
|
12
|
+
* A CloudFront Origin for AWS Elemental MediaPackage V2 endpoints.
|
|
13
|
+
*
|
|
14
|
+
* Automatically creates an OAC and wires the origin endpoint policy
|
|
15
|
+
* to grant the CloudFront distribution access.
|
|
16
|
+
*
|
|
17
|
+
* Uses `addToResourcePolicy()` on the origin endpoint, which is compatible
|
|
18
|
+
* with other policy statements added to the same endpoint. Do not use this
|
|
19
|
+
* alongside a manually created `OriginEndpointPolicy` construct for the same endpoint.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
*
|
|
23
|
+
* declare const endpoint: OriginEndpoint;
|
|
24
|
+
* declare const group: ChannelGroup;
|
|
25
|
+
*
|
|
26
|
+
* new cloudfront.Distribution(this, 'Dist', {
|
|
27
|
+
* defaultBehavior: {
|
|
28
|
+
* origin: new MediaPackageV2Origin(endpoint, {
|
|
29
|
+
* channelGroup: group,
|
|
30
|
+
* }),
|
|
31
|
+
* },
|
|
32
|
+
* });
|
|
33
|
+
*
|
|
34
|
+
* @see https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-restricting-access-to-mediapackage.html
|
|
35
|
+
*/
|
|
36
|
+
class MediaPackageV2Origin extends cloudfront.OriginBase {
|
|
37
|
+
static [JSII_RTTI_SYMBOL_1] = { fqn: "@aws-cdk/aws-mediapackagev2-alpha.MediaPackageV2Origin", version: "2.255.0-alpha.0" };
|
|
38
|
+
originAccessControl;
|
|
39
|
+
endpoint;
|
|
40
|
+
cdnAuth;
|
|
41
|
+
constructor(endpoint, props) {
|
|
42
|
+
try {
|
|
43
|
+
jsiiDeprecationWarnings._aws_cdk_aws_mediapackagev2_alpha_IOriginEndpoint(endpoint);
|
|
44
|
+
jsiiDeprecationWarnings._aws_cdk_aws_mediapackagev2_alpha_MediaPackageV2OriginProps(props);
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
if (process.env.JSII_DEBUG !== "1" && error.name === "DeprecationError") {
|
|
48
|
+
Error.captureStackTrace(error, MediaPackageV2Origin);
|
|
49
|
+
}
|
|
50
|
+
throw error;
|
|
51
|
+
}
|
|
52
|
+
if (!props.channelGroup.egressDomain) {
|
|
53
|
+
throw new core_1.UnscopedValidationError((0, helpers_internal_1.lit) `MissingEgressDomain`, 'The channel group must have an egressDomain to use as a CloudFront origin. Provide egressDomain when importing the channel group.');
|
|
54
|
+
}
|
|
55
|
+
super(props.channelGroup.egressDomain, props);
|
|
56
|
+
this.endpoint = endpoint;
|
|
57
|
+
this.originAccessControl = props.originAccessControl;
|
|
58
|
+
this.cdnAuth = props.cdnAuth;
|
|
59
|
+
}
|
|
60
|
+
renderCustomOriginConfig() {
|
|
61
|
+
return {
|
|
62
|
+
originSslProtocols: [cloudfront.OriginSslPolicy.TLS_V1_2],
|
|
63
|
+
originProtocolPolicy: cloudfront.OriginProtocolPolicy.HTTPS_ONLY,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
bind(scope, options) {
|
|
67
|
+
const originBindConfig = super.bind(scope, options);
|
|
68
|
+
if (!this.originAccessControl) {
|
|
69
|
+
this.originAccessControl = new cloudfront.MediaPackageV2OriginAccessControl(scope, 'MediaPackageV2OAC');
|
|
70
|
+
}
|
|
71
|
+
// Grant the CloudFront distribution access to the MediaPackage V2 origin endpoint
|
|
72
|
+
// Includes GetHeadObject for MQAR (Media Quality-Aware Resiliency) support
|
|
73
|
+
// @see https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-restricting-access-to-mediapackage.html
|
|
74
|
+
this.endpoint.addToResourcePolicy(new aws_iam_1.PolicyStatement({
|
|
75
|
+
sid: 'AllowCloudFrontServicePrincipal',
|
|
76
|
+
effect: aws_iam_1.Effect.ALLOW,
|
|
77
|
+
principals: [new aws_iam_1.ServicePrincipal('cloudfront.amazonaws.com')],
|
|
78
|
+
actions: ['mediapackagev2:GetObject', 'mediapackagev2:GetHeadObject'],
|
|
79
|
+
resources: [this.endpoint.originEndpointArn],
|
|
80
|
+
conditions: {
|
|
81
|
+
StringEquals: {
|
|
82
|
+
'aws:SourceArn': cdk.Stack.of(scope).formatArn({
|
|
83
|
+
service: 'cloudfront',
|
|
84
|
+
region: '',
|
|
85
|
+
resource: 'distribution',
|
|
86
|
+
resourceName: options.distributionId,
|
|
87
|
+
}),
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
}), this.cdnAuth);
|
|
91
|
+
return {
|
|
92
|
+
...originBindConfig,
|
|
93
|
+
originProperty: {
|
|
94
|
+
...originBindConfig.originProperty,
|
|
95
|
+
originAccessControlId: this.originAccessControl.originAccessControlRef.originAccessControlId,
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
exports.MediaPackageV2Origin = MediaPackageV2Origin;
|
|
101
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2xvdWRmcm9udC1vcmlnaW4uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJjbG91ZGZyb250LW9yaWdpbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUFBLG1DQUFtQztBQUNuQyx5REFBeUQ7QUFDekQsaURBQWdGO0FBQ2hGLDJDQUEyRDtBQUMzRCw0RUFBNEQ7QUFvQzVEOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7R0F3Qkc7QUFDSCxNQUFhLG9CQUFxQixTQUFRLFVBQVUsQ0FBQyxVQUFVOztJQUNyRCxtQkFBbUIsQ0FBc0M7SUFDaEQsUUFBUSxDQUFrQjtJQUMxQixPQUFPLENBQXdCO0lBRWhELFlBQVksUUFBeUIsRUFBRSxLQUFnQzs7Ozs7OzsrQ0FMNUQsb0JBQW9COzs7O1FBTTdCLElBQUksQ0FBQyxLQUFLLENBQUMsWUFBWSxDQUFDLFlBQVksRUFBRSxDQUFDO1lBQ3JDLE1BQU0sSUFBSSw4QkFBdUIsQ0FDL0IsSUFBQSxzQkFBRyxFQUFBLHFCQUFxQixFQUN4QixtSUFBbUksQ0FDcEksQ0FBQztRQUNKLENBQUM7UUFDRCxLQUFLLENBQUMsS0FBSyxDQUFDLFlBQVksQ0FBQyxZQUFZLEVBQUUsS0FBSyxDQUFDLENBQUM7UUFDOUMsSUFBSSxDQUFDLFFBQVEsR0F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