@aws-cdk_aws-kinesisanalytics-flink-alpha.Application

class Application (construct) ๐Ÿ”น

LanguageType name
.NETAmazon.CDK.AWS.Kinesisanalytics.Flink.Alpha.Application
Gogithub.com/aws/aws-cdk-go/awscdkkinesisanalyticsflinkalpha/v2#Application
Javasoftware.amazon.awscdk.services.kinesisanalytics.flink.alpha.Application
Pythonaws_cdk.aws_kinesisanalytics_flink_alpha.Application
TypeScript (source)@aws-cdk/aws-kinesisanalytics-flink-alpha ยป Application

Implements IConstruct, IDependable, IResource, IApplication, IConnectable, IGrantable

The L2 construct for Flink Kinesis Data Applications.

Example

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

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

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

new cloudwatch.Alarm(stack, 'Alarm', {
  metric: flinkApp.metricFullRestarts(),
  evaluationPeriods: 1,
  threshold: 3,
});
///! hide

app.synth();

Initializer

new Application(scope: Construct, id: string, props: ApplicationProps)

Parameters

  • scope Construct
  • id string
  • props ApplicationProps

Construct Props

NameTypeDescription
code๐Ÿ”นApplicationCodeThe Flink code asset to run.
runtime๐Ÿ”นRuntimeThe Flink version to use for this application.
applicationName?๐Ÿ”นstringA name for your Application that is unique to an AWS account.
autoScalingEnabled?๐Ÿ”นbooleanWhether the Kinesis Data Analytics service can increase the parallelism of the application in response to resource usage.
checkpointInterval?๐Ÿ”นDurationThe interval between checkpoints.
checkpointingEnabled?๐Ÿ”นbooleanWhether checkpointing is enabled while your application runs.
logGroup?๐Ÿ”นILogGroupThe log group to send log entries to.
logLevel?๐Ÿ”นLogLevelThe level of log verbosity from the Flink application.
metricsLevel?๐Ÿ”นMetricsLevelDescribes the granularity of the CloudWatch metrics for an application.
minPauseBetweenCheckpoints?๐Ÿ”นDurationThe minimum amount of time in to wait after a checkpoint finishes to start a new checkpoint.
parallelism?๐Ÿ”นnumberThe initial parallelism for the application.
parallelismPerKpu?๐Ÿ”นnumberThe Flink parallelism allowed per Kinesis Processing Unit (KPU).
propertyGroups?๐Ÿ”น{ [string]: { [string]: string } }Configuration PropertyGroups.
removalPolicy?๐Ÿ”นRemovalPolicyProvide a RemovalPolicy to override the default.
role?๐Ÿ”นIRoleA role to use to grant permissions to your application.
securityGroups?๐Ÿ”นISecurityGroup[]Security groups to use with a provided VPC.
snapshotsEnabled?๐Ÿ”นbooleanDetermines if Flink snapshots are enabled.
vpc?๐Ÿ”นIVpcDeploy the Flink application in a VPC.
vpcSubnets?๐Ÿ”นSubnetSelectionChoose which VPC subnets to use.

code๐Ÿ”น

Type: ApplicationCode

The Flink code asset to run.


runtime๐Ÿ”น

Type: Runtime

The Flink version to use for this application.


applicationName?๐Ÿ”น

Type: string (optional, default: CloudFormation-generated name)

A name for your Application that is unique to an AWS account.


autoScalingEnabled?๐Ÿ”น

Type: boolean (optional, default: true)

Whether the Kinesis Data Analytics service can increase the parallelism of the application in response to resource usage.


checkpointInterval?๐Ÿ”น

Type: Duration (optional, default: 1 minute)

The interval between checkpoints.


checkpointingEnabled?๐Ÿ”น

Type: boolean (optional, default: true)

Whether checkpointing is enabled while your application runs.


logGroup?๐Ÿ”น

Type: ILogGroup (optional, default: CDK's default LogGroup)

The log group to send log entries to.


logLevel?๐Ÿ”น

Type: LogLevel (optional, default: FlinkLogLevel.INFO)

The level of log verbosity from the Flink application.


metricsLevel?๐Ÿ”น

Type: MetricsLevel (optional, default: MetricsLevel.APPLICATION)

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).


minPauseBetweenCheckpoints?๐Ÿ”น

Type: Duration (optional, default: 5 seconds)

The minimum amount of time in to wait after a checkpoint finishes to start a new checkpoint.


parallelism?๐Ÿ”น

Type: number (optional, default: 1)

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).


parallelismPerKpu?๐Ÿ”น

Type: number (optional, default: 1)

The Flink parallelism allowed per Kinesis Processing Unit (KPU).


propertyGroups?๐Ÿ”น

Type: { [string]: { [string]: string } } (optional, default: No property group configuration provided to the Flink app)

Configuration PropertyGroups.

You can use these property groups to pass arbitrary runtime configuration values to your Flink app.


removalPolicy?๐Ÿ”น

Type: RemovalPolicy (optional, default: RemovalPolicy.DESTROY)

Provide a RemovalPolicy to override the default.


role?๐Ÿ”น

Type: IRole (optional, default: a new Role will be created)

A role to use to grant permissions to your application.

Prefer omitting this property and using the default role.


securityGroups?๐Ÿ”น

Type: ISecurityGroup[] (optional, default: a new security group is created for this application.)

Security groups to use with a provided VPC.


snapshotsEnabled?๐Ÿ”น

Type: boolean (optional, default: true)

Determines if Flink snapshots are enabled.


vpc?๐Ÿ”น

Type: IVpc (optional, default: no VPC)

Deploy the Flink application in a VPC.


vpcSubnets?๐Ÿ”น

Type: SubnetSelection (optional, default: SubnetType.PRIVATE_WITH_EGRESS subnets)

Choose which VPC subnets to use.

Properties

NameTypeDescription
applicationArn๐Ÿ”นstringThe application ARN.
applicationName๐Ÿ”นstringThe name of the Flink application.
connections๐Ÿ”นConnectionsThe network connections associated with this resource.
env๐Ÿ”นResourceEnvironmentThe environment this resource belongs to.
grantPrincipal๐Ÿ”นIPrincipalThe principal to grant permissions to.
node๐Ÿ”นNodeThe tree node.
stack๐Ÿ”นStackThe stack in which this resource is defined.
role?๐Ÿ”นIRoleThe application IAM role.

applicationArn๐Ÿ”น

Type: string

The application ARN.


applicationName๐Ÿ”น

Type: string

The name of the Flink application.


connections๐Ÿ”น

Type: Connections

The network connections associated with this resource.


env๐Ÿ”น

Type: ResourceEnvironment

The environment this resource belongs to.

For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.


grantPrincipal๐Ÿ”น

Type: IPrincipal

The principal to grant permissions to.


node๐Ÿ”น

Type: Node

The tree node.


stack๐Ÿ”น

Type: Stack

The stack in which this resource is defined.


role?๐Ÿ”น

Type: IRole (optional)

The application IAM role.

Methods

NameDescription
addToRolePolicy(policyStatement)๐Ÿ”นImplement the convenience IApplication.addToPrincipalPolicy method.
applyRemovalPolicy(policy)๐Ÿ”นApply the given removal policy to this resource.
metric(metricName, props?)๐Ÿ”นReturn a CloudWatch metric associated with this Flink application.
metricBackPressuredTimeMsPerSecond(props?)๐Ÿ”นThe time (in milliseconds) this task or operator is back pressured per second.
metricBusyTimePerMsPerSecond(props?)๐Ÿ”นThe time (in milliseconds) this task or operator is busy (neither idle nor back pressured) per second.
metricCpuUtilization(props?)๐Ÿ”นThe overall percentage of CPU utilization across task managers.
metricCurrentInputWatermark(props?)๐Ÿ”นThe last watermark this application/operator/task/thread has received.
metricCurrentOutputWatermark(props?)๐Ÿ”นThe last watermark this application/operator/task/thread has received.
metricDowntime(props?)๐Ÿ”นThe time elapsed during an outage for failing/recovering jobs.
metricFullRestarts(props?)๐Ÿ”นThe total number of times this job has fully restarted since it was submitted.
metricHeapMemoryUtilization(props?)๐Ÿ”นOverall heap memory utilization across task managers.
metricIdleTimeMsPerSecond(props?)๐Ÿ”นThe time (in milliseconds) this task or operator is idle (has no data to process) per second.
metricKpus(props?)๐Ÿ”นThe number of Kinesis Processing Units that are used to run your stream processing application.
metricLastCheckpointDuration(props?)๐Ÿ”นThe time it took to complete the last checkpoint.
metricLastCheckpointSize(props?)๐Ÿ”นThe total size of the last checkpoint.
metricManagedMemoryTotal(props?)๐Ÿ”นThe total amount of managed memory.
metricManagedMemoryUsed(props?)๐Ÿ”นThe amount of managed memory currently used.
metricManagedMemoryUtilization(props?)๐Ÿ”นDerived from managedMemoryUsed/managedMemoryTotal.
metricNumLateRecordsDropped(props?)๐Ÿ”นThe number of records this operator or task has dropped due to arriving late.
metricNumRecordsIn(props?)๐Ÿ”นThe total number of records this application, operator, or task has received.
metricNumRecordsInPerSecond(props?)๐Ÿ”นThe total number of records this application, operator or task has received per second.
metricNumRecordsOut(props?)๐Ÿ”นThe total number of records this application, operator or task has emitted.
metricNumRecordsOutPerSecond(props?)๐Ÿ”นThe total number of records this application, operator or task has emitted per second.
metricNumberOfFailedCheckpoints(props?)๐Ÿ”นThe number of times checkpointing has failed.
metricOldGenerationGCCount(props?)๐Ÿ”นThe total number of old garbage collection operations that have occurred across all task managers.
metricOldGenerationGCTime(props?)๐Ÿ”นThe total time spent performing old garbage collection operations.
metricThreadsCount(props?)๐Ÿ”นThe total number of live threads used by the application.
metricUptime(props?)๐Ÿ”นThe time that the job has been running without interruption.
toString()๐Ÿ”นReturns a string representation of this construct.
static fromApplicationArn(scope, id, applicationArn)๐Ÿ”นImport an existing application defined outside of CDK code by applicationArn.
static fromApplicationAttributes(scope, id, attrs)๐Ÿ”นImport an existing application defined outside of CDK code.
static fromApplicationName(scope, id, applicationName)๐Ÿ”นImport an existing Flink application defined outside of CDK code by applicationName.

addToRolePolicy(policyStatement)๐Ÿ”น

public addToRolePolicy(policyStatement: PolicyStatement): boolean

Parameters

  • policyStatement PolicyStatement

Returns

  • boolean

Implement the convenience IApplication.addToPrincipalPolicy method.


applyRemovalPolicy(policy)๐Ÿ”น

public applyRemovalPolicy(policy: RemovalPolicy): void

Parameters

  • policy RemovalPolicy

Apply the given removal policy to this resource.

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).


metric(metricName, props?)๐Ÿ”น

public metric(metricName: string, props?: MetricOptions): Metric

Parameters

  • metricName string โ€” The name of the metric.
  • props MetricOptions โ€” Customization properties.

Returns

  • Metric

Return a CloudWatch metric associated with this Flink application.


metricBackPressuredTimeMsPerSecond(props?)๐Ÿ”น

public metricBackPressuredTimeMsPerSecond(props?: MetricOptions): Metric

Parameters

  • props MetricOptions

Returns

  • Metric

The time (in milliseconds) this task or operator is back pressured per second.

Units: Milliseconds

Reporting Level: Operator, Task, Parallelism


metricBusyTimePerMsPerSecond(props?)๐Ÿ”น

public metricBusyTimePerMsPerSecond(props?: MetricOptions): Metric

Parameters

  • props MetricOptions

Returns

  • Metric

The time (in milliseconds) this task or operator is busy (neither idle nor back pressured) per second.

Can be NaN, if the value could not be calculated.

Units: Milliseconds

Reporting Level: Operator, Task, Parallelism


metricCpuUtilization(props?)๐Ÿ”น

public metricCpuUtilization(props?: MetricOptions): Metric

Parameters

  • props MetricOptions

Returns

  • Metric

The overall percentage of CPU utilization across task managers.

For example, if there are five task managers, Kinesis Data Analytics publishes five samples of this metric per reporting interval.

Units: Percentage

Reporting Level: Application


metricCurrentInputWatermark(props?)๐Ÿ”น

public metricCurrentInputWatermark(props?: MetricOptions): Metric

Parameters

  • props MetricOptions

Returns

  • Metric

The last watermark this application/operator/task/thread has received.

Units: Milliseconds

Reporting Level: Application, Operator, Task, Parallelism


metricCurrentOutputWatermark(props?)๐Ÿ”น

public metricCurrentOutputWatermark(props?: MetricOptions): Metric

Parameters

  • props MetricOptions

Returns

  • Metric

The last watermark this application/operator/task/thread has received.

Units: Milliseconds

Reporting Level: Application, Operator, Task, Parallelism


metricDowntime(props?)๐Ÿ”น

public metricDowntime(props?: MetricOptions): Metric

Parameters

  • props MetricOptions

Returns

  • Metric

The time elapsed during an outage for failing/recovering jobs.

Units: Milliseconds

Reporting Level: Application


metricFullRestarts(props?)๐Ÿ”น

public metricFullRestarts(props?: MetricOptions): Metric

Parameters

  • props MetricOptions

Returns

  • Metric

The total number of times this job has fully restarted since it was submitted.

This metric does not measure fine-grained restarts.

Units: Count

Reporting Level: Application


metricHeapMemoryUtilization(props?)๐Ÿ”น

public metricHeapMemoryUtilization(props?: MetricOptions): Metric

Parameters

  • props MetricOptions

Returns

  • Metric

Overall heap memory utilization across task managers.

For example, if there are five task managers, Kinesis Data Analytics publishes five samples of this metric per reporting interval.

Units: Percentage

Reporting Level: Application


metricIdleTimeMsPerSecond(props?)๐Ÿ”น

public metricIdleTimeMsPerSecond(props?: MetricOptions): Metric

Parameters

  • props MetricOptions

Returns

  • Metric

The time (in milliseconds) this task or operator is idle (has no data to process) per second.

Idle time excludes back pressured time, so if the task is back pressured it is not idle.

Units: Milliseconds

Reporting Level: Operator, Task, Parallelism


metricKpus(props?)๐Ÿ”น

public metricKpus(props?: MetricOptions): Metric

Parameters

  • props MetricOptions

Returns

  • Metric

The number of Kinesis Processing Units that are used to run your stream processing application.

The average number of KPUs used each hour determines the billing for your application.

Units: Count

Reporting Level: Application


metricLastCheckpointDuration(props?)๐Ÿ”น

public metricLastCheckpointDuration(props?: MetricOptions): Metric

Parameters

  • props MetricOptions

Returns

  • Metric

The time it took to complete the last checkpoint.

Units: Milliseconds

Reporting Level: Application


metricLastCheckpointSize(props?)๐Ÿ”น

public metricLastCheckpointSize(props?: MetricOptions): Metric

Parameters

  • props MetricOptions

Returns

  • Metric

The total size of the last checkpoint.

Units: Bytes

Reporting Level: Application


metricManagedMemoryTotal(props?)๐Ÿ”น

public metricManagedMemoryTotal(props?: MetricOptions): Metric

Parameters

  • props MetricOptions

Returns

  • Metric

The total amount of managed memory.

Units: Bytes

Reporting Level: Application, Operator, Task, Parallelism


metricManagedMemoryUsed(props?)๐Ÿ”น

public metricManagedMemoryUsed(props?: MetricOptions): Metric

Parameters

  • props MetricOptions

Returns

  • Metric

The amount of managed memory currently used.

Units: Bytes

Reporting Level: Application, Operator, Task, Parallelism


metricManagedMemoryUtilization(props?)๐Ÿ”น

public metricManagedMemoryUtilization(props?: MetricOptions): Metric

Parameters

  • props MetricOptions

Returns

  • Metric

Derived from managedMemoryUsed/managedMemoryTotal.

Units: Percentage

Reporting Level: Application, Operator, Task, Parallelism


metricNumLateRecordsDropped(props?)๐Ÿ”น

public metricNumLateRecordsDropped(props?: MetricOptions): Metric

Parameters

  • props MetricOptions

Returns

  • Metric

The number of records this operator or task has dropped due to arriving late.

Units: Count

Reporting Level: Application, Operator, Task, Parallelism


metricNumRecordsIn(props?)๐Ÿ”น

public metricNumRecordsIn(props?: MetricOptions): Metric

Parameters

  • props MetricOptions

Returns

  • Metric

The total number of records this application, operator, or task has received.

Units: Count

Reporting Level: Application, Operator, Task, Parallelism


metricNumRecordsInPerSecond(props?)๐Ÿ”น

public metricNumRecordsInPerSecond(props?: MetricOptions): Metric

Parameters

  • props MetricOptions

Returns

  • Metric

The total number of records this application, operator or task has received per second.

Units: Count/Second

Reporting Level: Application, Operator, Task, Parallelism


metricNumRecordsOut(props?)๐Ÿ”น

public metricNumRecordsOut(props?: MetricOptions): Metric

Parameters

  • props MetricOptions

Returns

  • Metric

The total number of records this application, operator or task has emitted.

Units: Count

Reporting Level: Application, Operator, Task, Parallelism


metricNumRecordsOutPerSecond(props?)๐Ÿ”น

public metricNumRecordsOutPerSecond(props?: MetricOptions): Metric

Parameters

  • props MetricOptions

Returns

  • Metric

The total number of records this application, operator or task has emitted per second.

Units: Count/Second

Reporting Level: Application, Operator, Task, Parallelism


metricNumberOfFailedCheckpoints(props?)๐Ÿ”น

public metricNumberOfFailedCheckpoints(props?: MetricOptions): Metric

Parameters

  • props MetricOptions

Returns

  • Metric

The number of times checkpointing has failed.

Units: Count

Reporting Level: Application


metricOldGenerationGCCount(props?)๐Ÿ”น

public metricOldGenerationGCCount(props?: MetricOptions): Metric

Parameters

  • props MetricOptions

Returns

  • Metric

The total number of old garbage collection operations that have occurred across all task managers.

Units: Count

Reporting Level: Application


metricOldGenerationGCTime(props?)๐Ÿ”น

public metricOldGenerationGCTime(props?: MetricOptions): Metric

Parameters

  • props MetricOptions

Returns

  • Metric

The total time spent performing old garbage collection operations.

Units: Milliseconds

Reporting Level: Application


metricThreadsCount(props?)๐Ÿ”น

public metricThreadsCount(props?: MetricOptions): Metric

Parameters

  • props MetricOptions

Returns

  • Metric

The total number of live threads used by the application.

Units: Count

Reporting Level: Application


metricUptime(props?)๐Ÿ”น

public metricUptime(props?: MetricOptions): Metric

Parameters

  • props MetricOptions

Returns

  • Metric

The time that the job has been running without interruption.

Units: Milliseconds

Reporting Level: Application


toString()๐Ÿ”น

public toString(): string

Returns

  • string

Returns a string representation of this construct.


static fromApplicationArn(scope, id, applicationArn)๐Ÿ”น

public static fromApplicationArn(scope: Construct, id: string, applicationArn: string): IApplication

Parameters

  • scope Construct
  • id string
  • applicationArn string

Returns

  • IApplication

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


static fromApplicationAttributes(scope, id, attrs)๐Ÿ”น

public static fromApplicationAttributes(scope: Construct, id: string, attrs: ApplicationAttributes): IApplication

Parameters

  • scope Construct
  • id string
  • attrs ApplicationAttributes

Returns

  • IApplication

Import an existing application defined outside of CDK code.


static fromApplicationName(scope, id, applicationName)๐Ÿ”น

public static fromApplicationName(scope: Construct, id: string, applicationName: string): IApplication

Parameters

  • scope Construct
  • id string
  • applicationName string

Returns

  • IApplication

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