awskinesisanalyticsflink

package
v1.204.0-devpreview Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

README

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:

import path "github.com/aws-samples/dummy/path"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
import cloudwatch "github.com/aws/aws-cdk-go/awscdk"

app := core.NewApp()
stack := core.NewStack(app, jsii.String("FlinkAppTest"))

flinkApp := flink.NewApplication(stack, jsii.String("App"), &ApplicationProps{
	Code: flink.ApplicationCode_FromAsset(path.join(__dirname, jsii.String("code-asset"))),
	Runtime: flink.Runtime_FLINK_1_11(),
})

cloudwatch.NewAlarm(stack, jsii.String("Alarm"), &AlarmProps{
	Metric: flinkApp.metricFullRestarts(),
	EvaluationPeriods: jsii.Number(1),
	Threshold: jsii.Number(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 "github.com/aws-samples/dummy/path"
import assets "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

app := core.NewApp()
stack := core.NewStack(app, jsii.String("FlinkAppCodeFromBucketTest"))

asset := assets.NewAsset(stack, jsii.String("CodeAsset"), &AssetProps{
	Path: path.join(__dirname, jsii.String("code-asset")),
})
bucket := asset.Bucket
fileKey := asset.S3ObjectKey

flink.NewApplication(stack, jsii.String("App"), &ApplicationProps{
	Code: flink.ApplicationCode_FromBucket(bucket, fileKey),
	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.

var bucket bucket

flinkApp := flink.NewApplication(this, jsii.String("Application"), &ApplicationProps{
	PropertyGroups: &PropertyGroups{
		FlinkApplicationProperties: map[string]*string{
			"inputStreamName": jsii.String("my-input-kinesis-stream"),
			"outputStreamName": jsii.String("my-output-kinesis-stream"),
		},
	},
	// ...
	Runtime: flink.Runtime_FLINK_1_13(),
	Code: flink.ApplicationCode_FromBucket(bucket, jsii.String("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.

var bucket bucket

flinkApp := flink.NewApplication(this, jsii.String("Application"), &ApplicationProps{
	Code: flink.ApplicationCode_FromBucket(bucket, jsii.String("my-app.jar")),
	Runtime: flink.Runtime_FLINK_1_13(),
	CheckpointingEnabled: jsii.Boolean(true),
	 // default is true
	CheckpointInterval: awscdk.Duration_Seconds(jsii.Number(30)),
	 // default is 1 minute
	MinPauseBetweenCheckpoints: awscdk.Duration_*Seconds(jsii.Number(10)),
	 // default is 5 seconds
	LogLevel: flink.LogLevel_ERROR,
	 // default is INFO
	MetricsLevel: flink.MetricsLevel_PARALLELISM,
	 // default is APPLICATION
	AutoScalingEnabled: jsii.Boolean(false),
	 // default is true
	Parallelism: jsii.Number(32),
	 // default is 1
	ParallelismPerKpu: jsii.Number(2),
	 // default is 1
	SnapshotsEnabled: jsii.Boolean(false),
	 // default is true
	LogGroup: logs.NewLogGroup(this, jsii.String("LogGroup")),
})

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Application_IsConstruct

func Application_IsConstruct(x interface{}) *bool

Return whether the given object is a Construct. Experimental.

func Application_IsResource

func Application_IsResource(construct awscdk.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
	// The application ARN.
	// Experimental.
	ApplicationArn() *string
	// The name of the Flink application.
	// Experimental.
	ApplicationName() *string
	// 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.
	// Experimental.
	Env() *awscdk.ResourceEnvironment
	// The principal to grant permissions to.
	// Experimental.
	GrantPrincipal() awsiam.IPrincipal
	// The construct tree node associated with this construct.
	// Experimental.
	Node() awscdk.ConstructNode
	// Returns a string-encoded token that resolves to the physical name that should be passed to the CloudFormation resource.
	//
	// This value will resolve to one of the following:
	// - a concrete value (e.g. `"my-awesome-bucket"`)
	// - `undefined`, when a name should be generated by CloudFormation
	// - a concrete name generated automatically during synthesis, in
	//    cross-environment scenarios.
	// Experimental.
	PhysicalName() *string
	// The application IAM role.
	// Experimental.
	Role() awsiam.IRole
	// The stack in which this resource is defined.
	// Experimental.
	Stack() awscdk.Stack
	// Implement the convenience {@link IApplication.addToPrincipalPolicy} method.
	// Experimental.
	AddToRolePolicy(policyStatement awsiam.PolicyStatement) *bool
	// 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`).
	// Experimental.
	ApplyRemovalPolicy(policy awscdk.RemovalPolicy)
	// Experimental.
	GeneratePhysicalName() *string
	// Returns an environment-sensitive token that should be used for the resource's "ARN" attribute (e.g. `bucket.bucketArn`).
	//
	// Normally, this token will resolve to `arnAttr`, but if the resource is
	// referenced across environments, `arnComponents` will be used to synthesize
	// a concrete ARN with the resource's physical name. Make sure to reference
	// `this.physicalName` in `arnComponents`.
	// Experimental.
	GetResourceArnAttribute(arnAttr *string, arnComponents *awscdk.ArnComponents) *string
	// Returns an environment-sensitive token that should be used for the resource's "name" attribute (e.g. `bucket.bucketName`).
	//
	// Normally, this token will resolve to `nameAttr`, but if the resource is
	// referenced across environments, it will be resolved to `this.physicalName`,
	// which will be a concrete name.
	// Experimental.
	GetResourceNameAttribute(nameAttr *string) *string
	// Return a CloudWatch metric associated with this Flink application.
	// Experimental.
	Metric(metricName *string, props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// The time (in milliseconds) this task or operator is back pressured per second.
	//
	// Units: Milliseconds
	//
	// Reporting Level: Operator, Task, Parallelism.
	// Experimental.
	MetricBackPressuredTimeMsPerSecond(props *awscloudwatch.MetricOptions) awscloudwatch.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.
	// Experimental.
	MetricBusyTimePerMsPerSecond(props *awscloudwatch.MetricOptions) awscloudwatch.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.
	// Experimental.
	MetricCpuUtilization(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// The last watermark this application/operator/task/thread has received.
	//
	// Units: Milliseconds
	//
	// Reporting Level: Application, Operator, Task, Parallelism.
	// Experimental.
	MetricCurrentInputWatermark(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// The last watermark this application/operator/task/thread has received.
	//
	// Units: Milliseconds
	//
	// Reporting Level: Application, Operator, Task, Parallelism.
	// Experimental.
	MetricCurrentOutputWatermark(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// The time elapsed during an outage for failing/recovering jobs.
	//
	// Units: Milliseconds
	//
	// Reporting Level: Application.
	// Experimental.
	MetricDowntime(props *awscloudwatch.MetricOptions) awscloudwatch.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.
	// Experimental.
	MetricFullRestarts(props *awscloudwatch.MetricOptions) awscloudwatch.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.
	// Experimental.
	MetricHeapMemoryUtilization(props *awscloudwatch.MetricOptions) awscloudwatch.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.
	// Experimental.
	MetricIdleTimeMsPerSecond(props *awscloudwatch.MetricOptions) awscloudwatch.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.
	// Experimental.
	MetricKpus(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// The time it took to complete the last checkpoint.
	//
	// Units: Milliseconds
	//
	// Reporting Level: Application.
	// Experimental.
	MetricLastCheckpointDuration(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// The total size of the last checkpoint.
	//
	// Units: Bytes
	//
	// Reporting Level: Application.
	// Experimental.
	MetricLastCheckpointSize(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// The total amount of managed memory.
	//
	// Units: Bytes
	//
	// Reporting Level: Application, Operator, Task, Parallelism.
	// Experimental.
	MetricManagedMemoryTotal(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// The amount of managed memory currently used.
	//
	// Units: Bytes
	//
	// Reporting Level: Application, Operator, Task, Parallelism.
	// Experimental.
	MetricManagedMemoryUsed(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Derived from managedMemoryUsed/managedMemoryTotal.
	//
	// Units: Percentage
	//
	// Reporting Level: Application, Operator, Task, Parallelism.
	// Experimental.
	MetricManagedMemoryUtilization(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// The number of times checkpointing has failed.
	//
	// Units: Count
	//
	// Reporting Level: Application.
	// Experimental.
	MetricNumberOfFailedCheckpoints(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// The number of records this operator or task has dropped due to arriving late.
	//
	// Units: Count
	//
	// Reporting Level: Application, Operator, Task, Parallelism.
	// Experimental.
	MetricNumLateRecordsDropped(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// The total number of records this application, operator, or task has received.
	//
	// Units: Count
	//
	// Reporting Level: Application, Operator, Task, Parallelism.
	// Experimental.
	MetricNumRecordsIn(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// The total number of records this application, operator or task has received per second.
	//
	// Units: Count/Second
	//
	// Reporting Level: Application, Operator, Task, Parallelism.
	// Experimental.
	MetricNumRecordsInPerSecond(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// The total number of records this application, operator or task has emitted.
	//
	// Units: Count
	//
	// Reporting Level: Application, Operator, Task, Parallelism.
	// Experimental.
	MetricNumRecordsOut(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// The total number of records this application, operator or task has emitted per second.
	//
	// Units: Count/Second
	//
	// Reporting Level: Application, Operator, Task, Parallelism.
	// Experimental.
	MetricNumRecordsOutPerSecond(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// The total number of old garbage collection operations that have occurred across all task managers.
	//
	// Units: Count
	//
	// Reporting Level: Application.
	// Experimental.
	MetricOldGenerationGCCount(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// The total time spent performing old garbage collection operations.
	//
	// Units: Milliseconds
	//
	// Reporting Level: Application.
	// Experimental.
	MetricOldGenerationGCTime(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// The total number of live threads used by the application.
	//
	// Units: Count
	//
	// Reporting Level: Application.
	// Experimental.
	MetricThreadsCount(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// The time that the job has been running without interruption.
	//
	// Units: Milliseconds
	//
	// Reporting Level: Application.
	// Experimental.
	MetricUptime(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Perform final modifications before synthesis.
	//
	// This method can be implemented by derived constructs in order to perform
	// final changes before synthesis. prepare() will be called after child
	// constructs have been prepared.
	//
	// This is an advanced framework feature. Only use this if you
	// understand the implications.
	// Experimental.
	OnPrepare()
	// Allows this construct to emit artifacts into the cloud assembly during synthesis.
	//
	// This method is usually implemented by framework-level constructs such as `Stack` and `Asset`
	// as they participate in synthesizing the cloud assembly.
	// Experimental.
	OnSynthesize(session constructs.ISynthesisSession)
	// Validate the current construct.
	//
	// This method can be implemented by derived constructs in order to perform
	// validation logic. It is called on all constructs before synthesis.
	//
	// Returns: An array of validation error messages, or an empty array if the construct is valid.
	// Experimental.
	OnValidate() *[]*string
	// Perform final modifications before synthesis.
	//
	// This method can be implemented by derived constructs in order to perform
	// final changes before synthesis. prepare() will be called after child
	// constructs have been prepared.
	//
	// This is an advanced framework feature. Only use this if you
	// understand the implications.
	// Experimental.
	Prepare()
	// Allows this construct to emit artifacts into the cloud assembly during synthesis.
	//
	// This method is usually implemented by framework-level constructs such as `Stack` and `Asset`
	// as they participate in synthesizing the cloud assembly.
	// Experimental.
	Synthesize(session awscdk.ISynthesisSession)
	// Returns a string representation of this construct.
	// Experimental.
	ToString() *string
	// Validate the current construct.
	//
	// This method can be implemented by derived constructs in order to perform
	// validation logic. It is called on all constructs before synthesis.
	//
	// Returns: An array of validation error messages, or an empty array if the construct is valid.
	// Experimental.
	Validate() *[]*string
}

The L2 construct for Flink Kinesis Data Applications.

Example:

import path "github.com/aws-samples/dummy/path"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
import cloudwatch "github.com/aws/aws-cdk-go/awscdk"

app := core.NewApp()
stack := core.NewStack(app, jsii.String("FlinkAppTest"))

flinkApp := flink.NewApplication(stack, jsii.String("App"), &ApplicationProps{
	Code: flink.ApplicationCode_FromAsset(path.join(__dirname, jsii.String("code-asset"))),
	Runtime: flink.Runtime_FLINK_1_11(),
})

cloudwatch.NewAlarm(stack, jsii.String("Alarm"), &AlarmProps{
	Metric: flinkApp.metricFullRestarts(),
	EvaluationPeriods: jsii.Number(1),
	Threshold: jsii.Number(3),
})

app.Synth()

Experimental.

func NewApplication

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

Experimental.

type ApplicationCode

type ApplicationCode interface {
	// A method to lazily bind asset resources to the parent FlinkApplication.
	// Experimental.
	Bind(scope awscdk.Construct) *ApplicationCodeConfig
}

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

Example:

import path "github.com/aws-samples/dummy/path"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
import cloudwatch "github.com/aws/aws-cdk-go/awscdk"

app := core.NewApp()
stack := core.NewStack(app, jsii.String("FlinkAppTest"))

flinkApp := flink.NewApplication(stack, jsii.String("App"), &ApplicationProps{
	Code: flink.ApplicationCode_FromAsset(path.join(__dirname, jsii.String("code-asset"))),
	Runtime: flink.Runtime_FLINK_1_11(),
})

cloudwatch.NewAlarm(stack, jsii.String("Alarm"), &AlarmProps{
	Metric: flinkApp.metricFullRestarts(),
	EvaluationPeriods: jsii.Number(1),
	Threshold: jsii.Number(3),
})

app.Synth()

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 `field:"required" json:"applicationCodeConfigurationProperty" yaml:"applicationCodeConfigurationProperty"`
	// S3 Bucket that stores the Flink application code.
	// Experimental.
	Bucket awss3.IBucket `field:"required" json:"bucket" yaml:"bucket"`
}

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

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

var bucket bucket

applicationCodeConfig := &ApplicationCodeConfig{
	ApplicationCodeConfigurationProperty: &ApplicationConfigurationProperty{
		ApplicationCodeConfiguration: &ApplicationCodeConfigurationProperty{
			CodeContent: &CodeContentProperty{
				S3ContentLocation: &S3ContentLocationProperty{
					BucketArn: jsii.String("bucketArn"),
					FileKey: jsii.String("fileKey"),

					// the properties below are optional
					ObjectVersion: jsii.String("objectVersion"),
				},
				TextContent: jsii.String("textContent"),
				ZipFileContent: jsii.String("zipFileContent"),
			},
			CodeContentType: jsii.String("codeContentType"),
		},
		ApplicationSnapshotConfiguration: &ApplicationSnapshotConfigurationProperty{
			SnapshotsEnabled: jsii.Boolean(false),
		},
		EnvironmentProperties: &EnvironmentPropertiesProperty{
			PropertyGroups: []interface{}{
				&PropertyGroupProperty{
					PropertyGroupId: jsii.String("propertyGroupId"),
					PropertyMap: map[string]*string{
						"propertyMapKey": jsii.String("propertyMap"),
					},
				},
			},
		},
		FlinkApplicationConfiguration: &FlinkApplicationConfigurationProperty{
			CheckpointConfiguration: &CheckpointConfigurationProperty{
				ConfigurationType: jsii.String("configurationType"),

				// the properties below are optional
				CheckpointingEnabled: jsii.Boolean(false),
				CheckpointInterval: jsii.Number(123),
				MinPauseBetweenCheckpoints: jsii.Number(123),
			},
			MonitoringConfiguration: &MonitoringConfigurationProperty{
				ConfigurationType: jsii.String("configurationType"),

				// the properties below are optional
				LogLevel: jsii.String("logLevel"),
				MetricsLevel: jsii.String("metricsLevel"),
			},
			ParallelismConfiguration: &ParallelismConfigurationProperty{
				ConfigurationType: jsii.String("configurationType"),

				// the properties below are optional
				AutoScalingEnabled: jsii.Boolean(false),
				Parallelism: jsii.Number(123),
				ParallelismPerKpu: jsii.Number(123),
			},
		},
		SqlApplicationConfiguration: &SqlApplicationConfigurationProperty{
			Inputs: []interface{}{
				&InputProperty{
					InputSchema: &InputSchemaProperty{
						RecordColumns: []interface{}{
							&RecordColumnProperty{
								Name: jsii.String("name"),
								SqlType: jsii.String("sqlType"),

								// the properties below are optional
								Mapping: jsii.String("mapping"),
							},
						},
						RecordFormat: &RecordFormatProperty{
							RecordFormatType: jsii.String("recordFormatType"),

							// the properties below are optional
							MappingParameters: &MappingParametersProperty{
								CsvMappingParameters: &CSVMappingParametersProperty{
									RecordColumnDelimiter: jsii.String("recordColumnDelimiter"),
									RecordRowDelimiter: jsii.String("recordRowDelimiter"),
								},
								JsonMappingParameters: &JSONMappingParametersProperty{
									RecordRowPath: jsii.String("recordRowPath"),
								},
							},
						},

						// the properties below are optional
						RecordEncoding: jsii.String("recordEncoding"),
					},
					NamePrefix: jsii.String("namePrefix"),

					// the properties below are optional
					InputParallelism: &InputParallelismProperty{
						Count: jsii.Number(123),
					},
					InputProcessingConfiguration: &InputProcessingConfigurationProperty{
						InputLambdaProcessor: &InputLambdaProcessorProperty{
							ResourceArn: jsii.String("resourceArn"),
						},
					},
					KinesisFirehoseInput: &KinesisFirehoseInputProperty{
						ResourceArn: jsii.String("resourceArn"),
					},
					KinesisStreamsInput: &KinesisStreamsInputProperty{
						ResourceArn: jsii.String("resourceArn"),
					},
				},
			},
		},
		VpcConfigurations: []interface{}{
			&VpcConfigurationProperty{
				SecurityGroupIds: []*string{
					jsii.String("securityGroupIds"),
				},
				SubnetIds: []*string{
					jsii.String("subnetIds"),
				},
			},
		},
		ZeppelinApplicationConfiguration: &ZeppelinApplicationConfigurationProperty{
			CatalogConfiguration: &CatalogConfigurationProperty{
				GlueDataCatalogConfiguration: &GlueDataCatalogConfigurationProperty{
					DatabaseArn: jsii.String("databaseArn"),
				},
			},
			CustomArtifactsConfiguration: []interface{}{
				&CustomArtifactConfigurationProperty{
					ArtifactType: jsii.String("artifactType"),

					// the properties below are optional
					MavenReference: &MavenReferenceProperty{
						ArtifactId: jsii.String("artifactId"),
						GroupId: jsii.String("groupId"),
						Version: jsii.String("version"),
					},
					S3ContentLocation: &S3ContentLocationProperty{
						BucketArn: jsii.String("bucketArn"),
						FileKey: jsii.String("fileKey"),

						// the properties below are optional
						ObjectVersion: jsii.String("objectVersion"),
					},
				},
			},
			DeployAsApplicationConfiguration: &DeployAsApplicationConfigurationProperty{
				S3ContentLocation: &S3ContentBaseLocationProperty{
					BucketArn: jsii.String("bucketArn"),

					// the properties below are optional
					BasePath: jsii.String("basePath"),
				},
			},
			MonitoringConfiguration: &ZeppelinMonitoringConfigurationProperty{
				LogLevel: jsii.String("logLevel"),
			},
		},
	},
	Bucket: bucket,
}

Experimental.

type ApplicationProps

type ApplicationProps struct {
	// The Flink code asset to run.
	// Experimental.
	Code ApplicationCode `field:"required" json:"code" yaml:"code"`
	// The Flink version to use for this application.
	// Experimental.
	Runtime Runtime `field:"required" json:"runtime" yaml:"runtime"`
	// A name for your Application that is unique to an AWS account.
	// Experimental.
	ApplicationName *string `field:"optional" json:"applicationName" yaml:"applicationName"`
	// Whether the Kinesis Data Analytics service can increase the parallelism of the application in response to resource usage.
	// Experimental.
	AutoScalingEnabled *bool `field:"optional" json:"autoScalingEnabled" yaml:"autoScalingEnabled"`
	// Whether checkpointing is enabled while your application runs.
	// Experimental.
	CheckpointingEnabled *bool `field:"optional" json:"checkpointingEnabled" yaml:"checkpointingEnabled"`
	// The interval between checkpoints.
	// Experimental.
	CheckpointInterval awscdk.Duration `field:"optional" json:"checkpointInterval" yaml:"checkpointInterval"`
	// The log group to send log entries to.
	// Experimental.
	LogGroup awslogs.ILogGroup `field:"optional" json:"logGroup" yaml:"logGroup"`
	// The level of log verbosity from the Flink application.
	// Experimental.
	LogLevel LogLevel `field:"optional" json:"logLevel" yaml:"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 `field:"optional" json:"metricsLevel" yaml:"metricsLevel"`
	// The minimum amount of time in to wait after a checkpoint finishes to start a new checkpoint.
	// Experimental.
	MinPauseBetweenCheckpoints awscdk.Duration `field:"optional" json:"minPauseBetweenCheckpoints" yaml:"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 `field:"optional" json:"parallelism" yaml:"parallelism"`
	// The Flink parallelism allowed per Kinesis Processing Unit (KPU).
	// Experimental.
	ParallelismPerKpu *float64 `field:"optional" json:"parallelismPerKpu" yaml:"parallelismPerKpu"`
	// Configuration PropertyGroups.
	//
	// You can use these property groups to pass
	// arbitrary runtime configuration values to your Flink app.
	// Experimental.
	PropertyGroups *PropertyGroups `field:"optional" json:"propertyGroups" yaml:"propertyGroups"`
	// Provide a RemovalPolicy to override the default.
	// Experimental.
	RemovalPolicy awscdk.RemovalPolicy `field:"optional" json:"removalPolicy" yaml:"removalPolicy"`
	// A role to use to grant permissions to your application.
	//
	// Prefer omitting
	// this property and using the default role.
	// Experimental.
	Role awsiam.IRole `field:"optional" json:"role" yaml:"role"`
	// Determines if Flink snapshots are enabled.
	// Experimental.
	SnapshotsEnabled *bool `field:"optional" json:"snapshotsEnabled" yaml:"snapshotsEnabled"`
}

Props for creating an Application construct.

Example:

import path "github.com/aws-samples/dummy/path"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
import cloudwatch "github.com/aws/aws-cdk-go/awscdk"

app := core.NewApp()
stack := core.NewStack(app, jsii.String("FlinkAppTest"))

flinkApp := flink.NewApplication(stack, jsii.String("App"), &ApplicationProps{
	Code: flink.ApplicationCode_FromAsset(path.join(__dirname, jsii.String("code-asset"))),
	Runtime: flink.Runtime_FLINK_1_11(),
})

cloudwatch.NewAlarm(stack, jsii.String("Alarm"), &AlarmProps{
	Metric: flinkApp.metricFullRestarts(),
	EvaluationPeriods: jsii.Number(1),
	Threshold: jsii.Number(3),
})

app.Synth()

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
	// Return a CloudWatch metric associated with this Flink application.
	// Experimental.
	Metric(metricName *string, props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// The time (in milliseconds) this task or operator is back pressured per second.
	//
	// Units: Milliseconds
	//
	// Reporting Level: Operator, Task, Parallelism.
	// Experimental.
	MetricBackPressuredTimeMsPerSecond(props *awscloudwatch.MetricOptions) awscloudwatch.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.
	// Experimental.
	MetricBusyTimePerMsPerSecond(props *awscloudwatch.MetricOptions) awscloudwatch.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.
	// Experimental.
	MetricCpuUtilization(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// The last watermark this application/operator/task/thread has received.
	//
	// Units: Milliseconds
	//
	// Reporting Level: Application, Operator, Task, Parallelism.
	// Experimental.
	MetricCurrentInputWatermark(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// The last watermark this application/operator/task/thread has received.
	//
	// Units: Milliseconds
	//
	// Reporting Level: Application, Operator, Task, Parallelism.
	// Experimental.
	MetricCurrentOutputWatermark(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// The time elapsed during an outage for failing/recovering jobs.
	//
	// Units: Milliseconds
	//
	// Reporting Level: Application.
	// Experimental.
	MetricDowntime(props *awscloudwatch.MetricOptions) awscloudwatch.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.
	// Experimental.
	MetricFullRestarts(props *awscloudwatch.MetricOptions) awscloudwatch.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.
	// Experimental.
	MetricHeapMemoryUtilization(props *awscloudwatch.MetricOptions) awscloudwatch.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.
	// Experimental.
	MetricIdleTimeMsPerSecond(props *awscloudwatch.MetricOptions) awscloudwatch.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.
	// Experimental.
	MetricKpus(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// The time it took to complete the last checkpoint.
	//
	// Units: Milliseconds
	//
	// Reporting Level: Application.
	// Experimental.
	MetricLastCheckpointDuration(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// The total size of the last checkpoint.
	//
	// Units: Bytes
	//
	// Reporting Level: Application.
	// Experimental.
	MetricLastCheckpointSize(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// The total amount of managed memory.
	//
	// Units: Bytes
	//
	// Reporting Level: Application, Operator, Task, Parallelism.
	// Experimental.
	MetricManagedMemoryTotal(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// The amount of managed memory currently used.
	//
	// Units: Bytes
	//
	// Reporting Level: Application, Operator, Task, Parallelism.
	// Experimental.
	MetricManagedMemoryUsed(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// Derived from managedMemoryUsed/managedMemoryTotal.
	//
	// Units: Percentage
	//
	// Reporting Level: Application, Operator, Task, Parallelism.
	// Experimental.
	MetricManagedMemoryUtilization(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// The number of times checkpointing has failed.
	//
	// Units: Count
	//
	// Reporting Level: Application.
	// Experimental.
	MetricNumberOfFailedCheckpoints(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// The number of records this operator or task has dropped due to arriving late.
	//
	// Units: Count
	//
	// Reporting Level: Application, Operator, Task, Parallelism.
	// Experimental.
	MetricNumLateRecordsDropped(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// The total number of records this application, operator, or task has received.
	//
	// Units: Count
	//
	// Reporting Level: Application, Operator, Task, Parallelism.
	// Experimental.
	MetricNumRecordsIn(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// The total number of records this application, operator or task has received per second.
	//
	// Units: Count/Second
	//
	// Reporting Level: Application, Operator, Task, Parallelism.
	// Experimental.
	MetricNumRecordsInPerSecond(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// The total number of records this application, operator or task has emitted.
	//
	// Units: Count
	//
	// Reporting Level: Application, Operator, Task, Parallelism.
	// Experimental.
	MetricNumRecordsOut(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// The total number of records this application, operator or task has emitted per second.
	//
	// Units: Count/Second
	//
	// Reporting Level: Application, Operator, Task, Parallelism.
	// Experimental.
	MetricNumRecordsOutPerSecond(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// The total number of old garbage collection operations that have occurred across all task managers.
	//
	// Units: Count
	//
	// Reporting Level: Application.
	// Experimental.
	MetricOldGenerationGCCount(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// The total time spent performing old garbage collection operations.
	//
	// Units: Milliseconds
	//
	// Reporting Level: Application.
	// Experimental.
	MetricOldGenerationGCTime(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// The total number of live threads used by the application.
	//
	// Units: Count
	//
	// Reporting Level: Application.
	// Experimental.
	MetricThreadsCount(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// The time that the job has been running without interruption.
	//
	// Units: Milliseconds
	//
	// Reporting Level: Application.
	// Experimental.
	MetricUptime(props *awscloudwatch.MetricOptions) awscloudwatch.Metric
	// 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.

Example:

var bucket bucket

flinkApp := flink.NewApplication(this, jsii.String("Application"), &ApplicationProps{
	Code: flink.ApplicationCode_FromBucket(bucket, jsii.String("my-app.jar")),
	Runtime: flink.Runtime_FLINK_1_13(),
	CheckpointingEnabled: jsii.Boolean(true),
	 // default is true
	CheckpointInterval: awscdk.Duration_Seconds(jsii.Number(30)),
	 // default is 1 minute
	MinPauseBetweenCheckpoints: awscdk.Duration_*Seconds(jsii.Number(10)),
	 // default is 5 seconds
	LogLevel: flink.LogLevel_ERROR,
	 // default is INFO
	MetricsLevel: flink.MetricsLevel_PARALLELISM,
	 // default is APPLICATION
	AutoScalingEnabled: jsii.Boolean(false),
	 // default is true
	Parallelism: jsii.Number(32),
	 // default is 1
	ParallelismPerKpu: jsii.Number(2),
	 // default is 1
	SnapshotsEnabled: jsii.Boolean(false),
	 // default is true
	LogGroup: logs.NewLogGroup(this, jsii.String("LogGroup")),
})

Experimental.

const (
	// Debug level logging.
	// Experimental.
	LogLevel_DEBUG LogLevel = "DEBUG"
	// Info level logging.
	// Experimental.
	LogLevel_INFO LogLevel = "INFO"
	// Warn level logging.
	// Experimental.
	LogLevel_WARN LogLevel = "WARN"
	// Error level logging.
	// Experimental.
	LogLevel_ERROR LogLevel = "ERROR"
)

type MetricsLevel

type MetricsLevel string

Granularity of metrics sent to CloudWatch.

Example:

var bucket bucket

flinkApp := flink.NewApplication(this, jsii.String("Application"), &ApplicationProps{
	Code: flink.ApplicationCode_FromBucket(bucket, jsii.String("my-app.jar")),
	Runtime: flink.Runtime_FLINK_1_13(),
	CheckpointingEnabled: jsii.Boolean(true),
	 // default is true
	CheckpointInterval: awscdk.Duration_Seconds(jsii.Number(30)),
	 // default is 1 minute
	MinPauseBetweenCheckpoints: awscdk.Duration_*Seconds(jsii.Number(10)),
	 // default is 5 seconds
	LogLevel: flink.LogLevel_ERROR,
	 // default is INFO
	MetricsLevel: flink.MetricsLevel_PARALLELISM,
	 // default is APPLICATION
	AutoScalingEnabled: jsii.Boolean(false),
	 // default is true
	Parallelism: jsii.Number(32),
	 // default is 1
	ParallelismPerKpu: jsii.Number(2),
	 // default is 1
	SnapshotsEnabled: jsii.Boolean(false),
	 // default is true
	LogGroup: logs.NewLogGroup(this, jsii.String("LogGroup")),
})

Experimental.

const (
	// Application sends the least metrics to CloudWatch.
	// Experimental.
	MetricsLevel_APPLICATION MetricsLevel = "APPLICATION"
	// Task includes task-level metrics sent to CloudWatch.
	// Experimental.
	MetricsLevel_TASK MetricsLevel = "TASK"
	// Operator includes task-level and operator-level metrics sent to CloudWatch.
	// Experimental.
	MetricsLevel_OPERATOR MetricsLevel = "OPERATOR"
	// Send all metrics including metrics per task thread.
	// Experimental.
	MetricsLevel_PARALLELISM MetricsLevel = "PARALLELISM"
)

type PropertyGroups

type PropertyGroups struct {
}

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

Example:

var bucket bucket

flinkApp := flink.NewApplication(this, jsii.String("Application"), &ApplicationProps{
	PropertyGroups: &PropertyGroups{
		FlinkApplicationProperties: map[string]*string{
			"inputStreamName": jsii.String("my-input-kinesis-stream"),
			"outputStreamName": jsii.String("my-output-kinesis-stream"),
		},
	},
	// ...
	Runtime: flink.Runtime_FLINK_1_13(),
	Code: flink.ApplicationCode_FromBucket(bucket, jsii.String("my-app.jar")),
})

Experimental.

type Runtime

type Runtime interface {
	// The Cfn string that represents a version of Flink.
	// Experimental.
	Value() *string
}

Available Flink runtimes for Kinesis Analytics.

Example:

import path "github.com/aws-samples/dummy/path"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
import cloudwatch "github.com/aws/aws-cdk-go/awscdk"

app := core.NewApp()
stack := core.NewStack(app, jsii.String("FlinkAppTest"))

flinkApp := flink.NewApplication(stack, jsii.String("App"), &ApplicationProps{
	Code: flink.ApplicationCode_FromAsset(path.join(__dirname, jsii.String("code-asset"))),
	Runtime: flink.Runtime_FLINK_1_11(),
})

cloudwatch.NewAlarm(stack, jsii.String("Alarm"), &AlarmProps{
	Metric: flinkApp.metricFullRestarts(),
	EvaluationPeriods: jsii.Number(1),
	Threshold: jsii.Number(3),
})

app.Synth()

Experimental.

func Runtime_FLINK_1_11() Runtime
func Runtime_FLINK_1_13() 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

Jump to

Keyboard shortcuts

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