awskinesisanalyticsflink

package
v1.175.0-devpreview Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2022 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 core "github.com/aws/aws-cdk-go/awscdk"
import flink "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 core "github.com/aws/aws-cdk-go/awscdk"
import flink "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 core "github.com/aws/aws-cdk-go/awscdk"
import flink "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 core "github.com/aws/aws-cdk-go/awscdk"
import flink "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 core "github.com/aws/aws-cdk-go/awscdk"
import flink "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 core "github.com/aws/aws-cdk-go/awscdk"
import flink "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