# Kinesis Analytics Flink
<!--BEGIN STABILITY BANNER-->---
![cdk-constructs: Experimental](https://img.shields.io/badge/cdk--constructs-experimental-important.svg?style=for-the-badge)
> The APIs of higher level constructs in this module are experimental and under active development.
> They are subject to non-backward compatible changes or removal in any future version. These are
> not subject to the [Semantic Versioning](https://semver.org/) model and breaking changes will be
> announced in the release notes. This means that while you may use them, you may need to update
> your source code when upgrading to a newer version of this package.
---
<!--END STABILITY BANNER-->
This package provides constructs for creating Kinesis Analytics Flink
applications. To learn more about using using managed Flink applications, see
the [AWS developer
guide](https://docs.aws.amazon.com/kinesisanalytics/latest/java/).
## Creating Flink Applications
To create a new Flink application, use the `Application` construct:
```python
import path as path
import aws_cdk.aws_cloudwatch as cloudwatch
import aws_cdk as core
import aws_cdk.aws_kinesisanalytics_flink_alpha as flink
app = core.App()
stack = core.Stack(app, "FlinkAppTest")
flink_app = flink.Application(stack, "App",
code=flink.ApplicationCode.from_asset(path.join(__dirname, "code-asset")),
runtime=flink.Runtime.FLINK_1_18
)
cloudwatch.Alarm(stack, "Alarm",
metric=flink_app.metric_full_restarts(),
evaluation_periods=1,
threshold=3
)
app.synth()
```
The `code` property can use `fromAsset` as shown above to reference a local jar
file in s3 or `fromBucket` to reference a file in s3.
```python
import path as path
import aws_cdk.aws_s3_assets as assets
import aws_cdk as core
import aws_cdk.aws_kinesisanalytics_flink_alpha as flink
app = core.App()
stack = core.Stack(app, "FlinkAppCodeFromBucketTest")
asset = assets.Asset(stack, "CodeAsset",
path=path.join(__dirname, "code-asset")
)
bucket = asset.bucket
file_key = asset.s3_object_key
flink.Application(stack, "App",
code=flink.ApplicationCode.from_bucket(bucket, file_key),
runtime=flink.Runtime.FLINK_1_18
)
app.synth()
```
The `propertyGroups` property provides a way of passing arbitrary runtime
properties to your Flink application. You can use the
aws-kinesisanalytics-runtime library to [retrieve these
properties](https://docs.aws.amazon.com/kinesisanalytics/latest/java/how-properties.html#how-properties-access).
```python
# bucket: s3.Bucket
flink_app = flink.Application(self, "Application",
property_groups={
"FlinkApplicationProperties": {
"input_stream_name": "my-input-kinesis-stream",
"output_stream_name": "my-output-kinesis-stream"
}
},
# ...
runtime=flink.Runtime.FLINK_1_18,
code=flink.ApplicationCode.from_bucket(bucket, "my-app.jar")
)
```
Flink applications also have specific configuration for passing parameters
when the Flink job starts. These include parameters for checkpointing,
snapshotting, monitoring, and parallelism.
```python
# bucket: s3.Bucket
flink_app = flink.Application(self, "Application",
code=flink.ApplicationCode.from_bucket(bucket, "my-app.jar"),
runtime=flink.Runtime.FLINK_1_18,
checkpointing_enabled=True, # default is true
checkpoint_interval=Duration.seconds(30), # default is 1 minute
min_pause_between_checkpoints=Duration.seconds(10), # default is 5 seconds
log_level=flink.LogLevel.ERROR, # default is INFO
metrics_level=flink.MetricsLevel.PARALLELISM, # default is APPLICATION
auto_scaling_enabled=False, # default is true
parallelism=32, # default is 1
parallelism_per_kpu=2, # default is 1
snapshots_enabled=False, # default is true
log_group=logs.LogGroup(self, "LogGroup")
)
```
Flink applications can optionally be deployed in a VPC:
```python
# bucket: s3.Bucket
# vpc: ec2.Vpc
flink_app = flink.Application(self, "Application",
code=flink.ApplicationCode.from_bucket(bucket, "my-app.jar"),
runtime=flink.Runtime.FLINK_1_18,
vpc=vpc
)
```
Raw data
{
"_id": null,
"home_page": "https://github.com/aws/aws-cdk",
"name": "aws-cdk.aws-kinesisanalytics-flink-alpha",
"maintainer": null,
"docs_url": null,
"requires_python": "~=3.8",
"maintainer_email": null,
"keywords": null,
"author": "Amazon Web Services",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/96/0b/0a4a8ca44eee19a00b81449ac57b14d5e0414c4ef95e5e9af97fe869a624/aws-cdk.aws-kinesisanalytics-flink-alpha-2.146.0a0.tar.gz",
"platform": null,
"description": "# Kinesis Analytics Flink\n\n<!--BEGIN STABILITY BANNER-->---\n\n\n![cdk-constructs: Experimental](https://img.shields.io/badge/cdk--constructs-experimental-important.svg?style=for-the-badge)\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<!--END STABILITY BANNER-->\n\nThis package provides constructs for creating Kinesis Analytics Flink\napplications. To learn more about using using managed Flink applications, see\nthe [AWS developer\nguide](https://docs.aws.amazon.com/kinesisanalytics/latest/java/).\n\n## Creating Flink Applications\n\nTo create a new Flink application, use the `Application` construct:\n\n```python\nimport path as path\nimport aws_cdk.aws_cloudwatch as cloudwatch\nimport aws_cdk as core\nimport aws_cdk.aws_kinesisanalytics_flink_alpha as flink\n\napp = core.App()\nstack = core.Stack(app, \"FlinkAppTest\")\n\nflink_app = flink.Application(stack, \"App\",\n code=flink.ApplicationCode.from_asset(path.join(__dirname, \"code-asset\")),\n runtime=flink.Runtime.FLINK_1_18\n)\n\ncloudwatch.Alarm(stack, \"Alarm\",\n metric=flink_app.metric_full_restarts(),\n evaluation_periods=1,\n threshold=3\n)\n\napp.synth()\n```\n\nThe `code` property can use `fromAsset` as shown above to reference a local jar\nfile in s3 or `fromBucket` to reference a file in s3.\n\n```python\nimport path as path\nimport aws_cdk.aws_s3_assets as assets\nimport aws_cdk as core\nimport aws_cdk.aws_kinesisanalytics_flink_alpha as flink\n\napp = core.App()\nstack = core.Stack(app, \"FlinkAppCodeFromBucketTest\")\n\nasset = assets.Asset(stack, \"CodeAsset\",\n path=path.join(__dirname, \"code-asset\")\n)\nbucket = asset.bucket\nfile_key = asset.s3_object_key\n\nflink.Application(stack, \"App\",\n code=flink.ApplicationCode.from_bucket(bucket, file_key),\n runtime=flink.Runtime.FLINK_1_18\n)\n\napp.synth()\n```\n\nThe `propertyGroups` property provides a way of passing arbitrary runtime\nproperties to your Flink application. You can use the\naws-kinesisanalytics-runtime library to [retrieve these\nproperties](https://docs.aws.amazon.com/kinesisanalytics/latest/java/how-properties.html#how-properties-access).\n\n```python\n# bucket: s3.Bucket\n\nflink_app = flink.Application(self, \"Application\",\n property_groups={\n \"FlinkApplicationProperties\": {\n \"input_stream_name\": \"my-input-kinesis-stream\",\n \"output_stream_name\": \"my-output-kinesis-stream\"\n }\n },\n # ...\n runtime=flink.Runtime.FLINK_1_18,\n code=flink.ApplicationCode.from_bucket(bucket, \"my-app.jar\")\n)\n```\n\nFlink applications also have specific configuration for passing parameters\nwhen the Flink job starts. These include parameters for checkpointing,\nsnapshotting, monitoring, and parallelism.\n\n```python\n# bucket: s3.Bucket\n\nflink_app = flink.Application(self, \"Application\",\n code=flink.ApplicationCode.from_bucket(bucket, \"my-app.jar\"),\n runtime=flink.Runtime.FLINK_1_18,\n checkpointing_enabled=True, # default is true\n checkpoint_interval=Duration.seconds(30), # default is 1 minute\n min_pause_between_checkpoints=Duration.seconds(10), # default is 5 seconds\n log_level=flink.LogLevel.ERROR, # default is INFO\n metrics_level=flink.MetricsLevel.PARALLELISM, # default is APPLICATION\n auto_scaling_enabled=False, # default is true\n parallelism=32, # default is 1\n parallelism_per_kpu=2, # default is 1\n snapshots_enabled=False, # default is true\n log_group=logs.LogGroup(self, \"LogGroup\")\n)\n```\n\nFlink applications can optionally be deployed in a VPC:\n\n```python\n# bucket: s3.Bucket\n# vpc: ec2.Vpc\n\nflink_app = flink.Application(self, \"Application\",\n code=flink.ApplicationCode.from_bucket(bucket, \"my-app.jar\"),\n runtime=flink.Runtime.FLINK_1_18,\n vpc=vpc\n)\n```\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "A CDK Construct Library for Kinesis Analytics Flink applications",
"version": "2.146.0a0",
"project_urls": {
"Homepage": "https://github.com/aws/aws-cdk",
"Source": "https://github.com/aws/aws-cdk.git"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d205e4121a8a0ab54362850986d0287acc584ad690b85bdd7ded0c586fc4a00d",
"md5": "a272bb8a3d52b173a2f75a1ec629e033",
"sha256": "4d5f84f0a014c49e2a6af16334998b36e34356ca8667d170ed4eea0d999bf8dc"
},
"downloads": -1,
"filename": "aws_cdk.aws_kinesisanalytics_flink_alpha-2.146.0a0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a272bb8a3d52b173a2f75a1ec629e033",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "~=3.8",
"size": 103658,
"upload_time": "2024-06-13T22:36:47",
"upload_time_iso_8601": "2024-06-13T22:36:47.463486Z",
"url": "https://files.pythonhosted.org/packages/d2/05/e4121a8a0ab54362850986d0287acc584ad690b85bdd7ded0c586fc4a00d/aws_cdk.aws_kinesisanalytics_flink_alpha-2.146.0a0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "960b0a4a8ca44eee19a00b81449ac57b14d5e0414c4ef95e5e9af97fe869a624",
"md5": "45c8ac7334f50533d175b2c09ce4f847",
"sha256": "39de3216d8708524786d3ce579d0c710adf6edbb5baa81739acb27851a4d1c6f"
},
"downloads": -1,
"filename": "aws-cdk.aws-kinesisanalytics-flink-alpha-2.146.0a0.tar.gz",
"has_sig": false,
"md5_digest": "45c8ac7334f50533d175b2c09ce4f847",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "~=3.8",
"size": 104066,
"upload_time": "2024-06-13T22:38:21",
"upload_time_iso_8601": "2024-06-13T22:38:21.550483Z",
"url": "https://files.pythonhosted.org/packages/96/0b/0a4a8ca44eee19a00b81449ac57b14d5e0414c4ef95e5e9af97fe869a624/aws-cdk.aws-kinesisanalytics-flink-alpha-2.146.0a0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-06-13 22:38:21",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "aws",
"github_project": "aws-cdk",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "aws-cdk.aws-kinesisanalytics-flink-alpha"
}