A CDK Construct Library for Kinesis Analytics Flink applications
Project description
Kinesis Analytics Flink
---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 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.
This package provides constructs for creating Kinesis Analytics Flink applications. To learn more about using using managed Flink applications, see the AWS developer guide.
Creating Flink Applications
To create a new Flink application, use the Application
construct:
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_11
)
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.
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_11
)
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.
# bucket: s3.Bucket
flink_app = flink.Application(self, "Application",
property_groups=flink.PropertyGroups(
FlinkApplicationProperties={
"input_stream_name": "my-input-kinesis-stream",
"output_stream_name": "my-output-kinesis-stream"
}
),
# ...
runtime=flink.Runtime.FLINK_1_13,
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.
# bucket: s3.Bucket
flink_app = flink.Application(self, "Application",
code=flink.ApplicationCode.from_bucket(bucket, "my-app.jar"),
runtime=flink.Runtime.FLINK_1_13,
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")
)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file aws-cdk.aws-kinesisanalytics-flink-alpha-2.45.0a0.tar.gz
.
File metadata
- Download URL: aws-cdk.aws-kinesisanalytics-flink-alpha-2.45.0a0.tar.gz
- Upload date:
- Size: 94.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8cd95b2263b261bf3517ad768587e632be86a189e5bfab6a0e2d22f249539a10 |
|
MD5 | 87835b5d9632d56d6d13b316539e6746 |
|
BLAKE2b-256 | 6e534e3a96d5d3c1c2b172b7a57d8b73c04caf61967dc0bee41674acc7125812 |
File details
Details for the file aws_cdk.aws_kinesisanalytics_flink_alpha-2.45.0a0-py3-none-any.whl
.
File metadata
- Download URL: aws_cdk.aws_kinesisanalytics_flink_alpha-2.45.0a0-py3-none-any.whl
- Upload date:
- Size: 93.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d9724f317e156d6cfbc074aa9f4fe1205f99d9e89bac1b0e71aca6c374fe610a |
|
MD5 | 3a7b69acd4ddea981f6ef5700f4b9dcd |
|
BLAKE2b-256 | 2b802650e6611c9156291bcaad34671e3db35726071124a26a1a860281926f32 |