This release is a pre-release and may not be stable for production use.
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.integ_tests_alpha as integ
import aws_cdk as core
import aws_cdk.aws_cloudwatch as cloudwatch
import aws_cdk.aws_kinesisanalytics_flink_alpha as flink
app = core.App()
stack = core.Stack(app, "FlinkAppTest")
flink_runtimes = [flink.Runtime.FLINK_1_15, flink.Runtime.FLINK_1_18, flink.Runtime.FLINK_1_19, flink.Runtime.FLINK_1_20
]
flink_runtimes.for_each((runtime) => {
const flinkApp = new flink.Application(stack, `App-${runtime.value}`, {
code: flink.ApplicationCode.fromAsset(path.join(__dirname, 'code-asset')),
runtime: runtime,
});
new cloudwatch.Alarm(stack, `Alarm-${runtime.value}`, {
metric: flinkApp.metricFullRestarts(),
evaluationPeriods: 1,
threshold: 3,
});
})
integ.IntegTest(app, "ApplicationTest",
test_cases=[stack]
)
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.
flink.Application(stack, "App",
code=flink.ApplicationCode.from_bucket(bucket, file_key),
runtime=flink.Runtime.FLINK_1_19
)
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={
"FlinkApplicationProperties": {
"input_stream_name": "my-input-kinesis-stream",
"output_stream_name": "my-output-kinesis-stream"
}
},
# ...
runtime=flink.Runtime.FLINK_1_20,
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_20,
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:
# 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_20,
vpc=vpc
)
Release files for aws-cdk.aws-kinesisanalytics-flink-alpha 2.270.0a0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| aws_cdk_aws_kinesisanalytics_flink_alpha-2.270.0a0.tar.gz | 120.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| aws_cdk_aws_kinesisanalytics_flink_alpha-2.270.0a0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 241.4 kB
Release files / aws_cdk_aws_kinesisanalytics_flink_alpha-2.270.0a0.tar.gz
| Download URL | aws_cdk_aws_kinesisanalytics_flink_alpha-2.270.0a0.tar.gz |
|---|---|
| Size | 120.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
72d9303c13a4c759c2b13fd9be079b3cd5c466213c867a3ac396ba7dc21bbf32
|
|
BLAKE2b-256 checksum How to use checksums |
39834a471e62ae94df982a4b5a6ba8a9b3fa8629f6a5cd9a149de8b515fe035c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.15
|
Release files / aws_cdk_aws_kinesisanalytics_flink_alpha-2.270.0a0-py3-none-any.whl
| Download URL | aws_cdk_aws_kinesisanalytics_flink_alpha-2.270.0a0-py3-none-any.whl |
|---|---|
| Size | 120.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5eba557baad716d1c079080ae8a88634017be686fefda977483411447b17f8f5
|
|
BLAKE2b-256 checksum How to use checksums |
b8dfe5b46e75ee621b13acfd7085fb8365beaa4a201eae8db2d0f01506ecc765
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.15
|