awscdkawskinesisanalyticsflinkalpha

package module
v2.0.0-rc.24 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 13, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

README


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.

To create a new Flink application, use the Application construct:

///! show
import * as path from 'path';
import * as core from 'aws-cdk-lib';
import * as flink from '../lib';

const app = new core.App();
const stack = new core.Stack(app, 'FlinkAppTest');

new flink.Application(stack, 'App', {
  code: flink.ApplicationCode.fromAsset(path.join(__dirname, 'code-asset')),
  runtime: flink.Runtime.FLINK_1_11,
});
///! hide

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 * as path from 'path';
import * as assets from 'aws-cdk-lib/aws-s3-assets';
import * as core from 'aws-cdk-lib';
import * as flink from '../lib';

const app = new core.App();
const stack = new core.Stack(app, 'FlinkAppCodeFromBucketTest');

const asset = new assets.Asset(stack, 'CodeAsset', {
  path: path.join(__dirname, 'code-asset'),
});
const bucket = asset.bucket;
const fileKey = asset.s3ObjectKey;

///! show
new flink.Application(stack, 'App', {
  code: flink.ApplicationCode.fromBucket(bucket, fileKey),
  runtime: flink.Runtime.FLINK_1_11,
});
///! hide

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.

import * as flink from '@aws-cdk/aws-kinesisanalytics-flink';

const flinkApp = new flink.Application(this, 'Application', {
  // ...
  propertyGroups: {
    FlinkApplicationProperties: {
      inputStreamName: 'my-input-kinesis-stream',
      outputStreamName: 'my-output-kinesis-stream',
    },
  },
});

Flink applications also have specific configuration for passing parameters when the Flink job starts. These include parameters for checkpointing, snapshotting, monitoring, and parallelism.

import * as logs from '@aws-cdk/aws-logs';

const flinkApp = new flink.Application(this, 'Application', {
  code: flink.ApplicationCode.fromBucket(bucket, 'my-app.jar'),
  runtime: file.Runtime.FLINK_1_11,
  checkpointingEnabled: true, // default is true
  checkpointInterval: cdk.Duration.seconds(30), // default is 1 minute
  minPauseBetweenCheckpoints: cdk.Duration.seconds(10), // default is 5 seconds
  logLevel: flink.LogLevel.ERROR, // default is INFO
  metricsLevel: flink.MetricsLevel.PARALLELISM, // default is APPLICATION
  autoScalingEnabled: false, // default is true
  parallelism: 32, // default is 1
  parallelismPerKpu: 2, // default is 1
  snapshotsEnabled: false, // default is true
  logGroup: new logs.LogGroup(this, 'LogGroup'), // by default, a new LogGroup will be created
});

Documentation

Overview

A CDK Construct Library for Kinesis Analytics Flink applications

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Application_IsConstruct

func Application_IsConstruct(x interface{}) *bool

Checks if `x` is a construct.

Returns: true if `x` is an object created from a class which extends `Construct`. Deprecated: use `x instanceof Construct` instead

func Application_IsResource

func Application_IsResource(construct constructs.IConstruct) *bool

Check whether the given construct is a Resource. Experimental.

func NewApplicationCode_Override

func NewApplicationCode_Override(a ApplicationCode)

Experimental.

func NewApplication_Override

func NewApplication_Override(a Application, scope constructs.Construct, id *string, props *ApplicationProps)

Experimental.

Types

type Application

type Application interface {
	awscdk.Resource
	IApplication
	ApplicationArn() *string
	ApplicationName() *string
	Env() *awscdk.ResourceEnvironment
	GrantPrincipal() awsiam.IPrincipal
	Node() constructs.Node
	PhysicalName() *string
	Role() awsiam.IRole
	Stack() awscdk.Stack
	AddToRolePolicy(policyStatement awsiam.PolicyStatement) *bool
	ApplyRemovalPolicy(policy awscdk.RemovalPolicy)
	GeneratePhysicalName() *string
	GetResourceArnAttribute(arnAttr *string, arnComponents *awscdk.ArnComponents) *string
	GetResourceNameAttribute(nameAttr *string) *string
	ToString() *string
}

The L2 construct for Flink Kinesis Data Applications. Experimental.

func NewApplication

func NewApplication(scope constructs.Construct, id *string, props *ApplicationProps) Application

Experimental.

type ApplicationCode

type ApplicationCode interface {
	Bind(scope constructs.Construct) *ApplicationCodeConfig
}

Code configuration providing the location to a Flink application JAR file. Experimental.

func ApplicationCode_FromAsset

func ApplicationCode_FromAsset(path *string, options *awss3assets.AssetOptions) ApplicationCode

Reference code from a local directory containing a Flink JAR file. Experimental.

func ApplicationCode_FromBucket

func ApplicationCode_FromBucket(bucket awss3.IBucket, fileKey *string, objectVersion *string) ApplicationCode

Reference code from an S3 bucket. Experimental.

type ApplicationCodeConfig

type ApplicationCodeConfig struct {
	// Low-level Cloudformation ApplicationConfigurationProperty.
	// Experimental.
	ApplicationCodeConfigurationProperty *awskinesisanalytics.CfnApplicationV2_ApplicationConfigurationProperty `json:"applicationCodeConfigurationProperty"`
	// S3 Bucket that stores the Flink application code.
	// Experimental.
	Bucket awss3.IBucket `json:"bucket"`
}

The return type of {@link ApplicationCode.bind}. This represents CloudFormation configuration and an s3 bucket holding the Flink application JAR file. Experimental.

type ApplicationProps

type ApplicationProps struct {
	// The Flink code asset to run.
	// Experimental.
	Code ApplicationCode `json:"code"`
	// The Flink version to use for this application.
	// Experimental.
	Runtime Runtime `json:"runtime"`
	// A name for your Application that is unique to an AWS account.
	// Experimental.
	ApplicationName *string `json:"applicationName"`
	// Whether the Kinesis Data Analytics service can increase the parallelism of the application in response to resource usage.
	// Experimental.
	AutoScalingEnabled *bool `json:"autoScalingEnabled"`
	// Whether checkpointing is enabled while your application runs.
	// Experimental.
	CheckpointingEnabled *bool `json:"checkpointingEnabled"`
	// The interval between checkpoints.
	// Experimental.
	CheckpointInterval awscdk.Duration `json:"checkpointInterval"`
	// The log group to send log entries to.
	// Experimental.
	LogGroup awslogs.ILogGroup `json:"logGroup"`
	// The level of log verbosity from the Flink application.
	// Experimental.
	LogLevel LogLevel `json:"logLevel"`
	// Describes the granularity of the CloudWatch metrics for an application.
	//
	// Use caution with Parallelism level metrics. Parallelism granularity logs
	// metrics for each parallel thread and can quickly become expensive when
	// parallelism is high (e.g. > 64).
	// Experimental.
	MetricsLevel MetricsLevel `json:"metricsLevel"`
	// The minimum amount of time in to wait after a checkpoint finishes to start a new checkpoint.
	// Experimental.
	MinPauseBetweenCheckpoints awscdk.Duration `json:"minPauseBetweenCheckpoints"`
	// The initial parallelism for the application.
	//
	// Kinesis Data Analytics can
	// stop the app, increase the parallelism, and start the app again if
	// autoScalingEnabled is true (the default value).
	// Experimental.
	Parallelism *float64 `json:"parallelism"`
	// The Flink parallelism allowed per Kinesis Processing Unit (KPU).
	// Experimental.
	ParallelismPerKpu *float64 `json:"parallelismPerKpu"`
	// Configuration PropertyGroups.
	//
	// You can use these property groups to pass
	// arbitrary runtime configuration values to your Flink app.
	// Experimental.
	PropertyGroups *PropertyGroups `json:"propertyGroups"`
	// Provide a RemovalPolicy to override the default.
	// Experimental.
	RemovalPolicy awscdk.RemovalPolicy `json:"removalPolicy"`
	// A role to use to grant permissions to your application.
	//
	// Prefer omitting
	// this property and using the default role.
	// Experimental.
	Role awsiam.IRole `json:"role"`
	// Determines if Flink snapshots are enabled.
	// Experimental.
	SnapshotsEnabled *bool `json:"snapshotsEnabled"`
}

Props for creating an Application construct. Experimental.

type IApplication

type IApplication interface {
	awsiam.IGrantable
	awscdk.IResource
	// Convenience method for adding a policy statement to the application role.
	// Experimental.
	AddToRolePolicy(policyStatement awsiam.PolicyStatement) *bool
	// The application ARN.
	// Experimental.
	ApplicationArn() *string
	// The name of the Flink application.
	// Experimental.
	ApplicationName() *string
	// The application IAM role.
	// Experimental.
	Role() awsiam.IRole
}

An interface expressing the public properties on both an imported and CDK-created Flink application. Experimental.

func Application_FromApplicationArn

func Application_FromApplicationArn(scope constructs.Construct, id *string, applicationArn *string) IApplication

Import an existing application defined outside of CDK code by applicationArn. Experimental.

func Application_FromApplicationName

func Application_FromApplicationName(scope constructs.Construct, id *string, applicationName *string) IApplication

Import an existing Flink application defined outside of CDK code by applicationName. Experimental.

type LogLevel

type LogLevel string

Available log levels for Flink applications. Experimental.

const (
	LogLevel_DEBUG LogLevel = "DEBUG"
	LogLevel_INFO  LogLevel = "INFO"
	LogLevel_WARN  LogLevel = "WARN"
	LogLevel_ERROR LogLevel = "ERROR"
)

type MetricsLevel

type MetricsLevel string

Granularity of metrics sent to CloudWatch. Experimental.

const (
	MetricsLevel_APPLICATION MetricsLevel = "APPLICATION"
	MetricsLevel_TASK        MetricsLevel = "TASK"
	MetricsLevel_OPERATOR    MetricsLevel = "OPERATOR"
	MetricsLevel_PARALLELISM MetricsLevel = "PARALLELISM"
)

type PropertyGroups

type PropertyGroups struct {
}

Interface for building AWS::KinesisAnalyticsV2::Application PropertyGroup configuration. Experimental.

type Runtime

type Runtime interface {
	Value() *string
}

Available Flink runtimes for Kinesis Analytics. Experimental.

func Runtime_FLINK_1_11() Runtime
func Runtime_FLINK_1_6() Runtime
func Runtime_FLINK_1_8() Runtime

func Runtime_Of

func Runtime_Of(value *string) Runtime

Create a new Runtime with with an arbitrary Flink version string. Experimental.

Directories

Path Synopsis
Package jsii contains the functionaility needed for jsii packages to initialize their dependencies and themselves.
Package jsii contains the functionaility needed for jsii packages to initialize their dependencies and themselves.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL