Amazon Managed Service for Apache Flink は、以前は Amazon Kinesis Data Analytics for Apache Flink と呼ばれていました。
翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。
Managed Service for Apache Flink APIのサンプルコード
このトピックには、Apache Flink 用 Managed Service アクションのリクエストブロックの例が含まれています。
AWS Command Line Interface (AWS CLI) を使用したアクションの入力JSONとして を使用するには、 リクエストを JSON ファイルに保存します。次に、 --cli-input-json
パラメータを使用してファイル名をアクションに渡します。
次の例は、 アクションでJSONファイルを使用する方法を示しています。
$ aws kinesisanalyticsv2 start-application --cli-input-json file://start.json
JSON で を使用する方法の詳細については AWS CLI、 AWS Command Line Interface ユーザーガイドのCLI「スケルトンとCLI入力JSONパラメータの生成」を参照してください。
トピック
- AddApplicationCloudWatchLoggingOption
- AddApplicationInput
- AddApplicationInputProcessingConfiguration
- AddApplicationOutput
- AddApplicationReferenceDataSource
- AddApplicationVpcConfiguration
- CreateApplication
- CreateApplicationSnapshot
- DeleteApplication
- DeleteApplicationCloudWatchLoggingOption
- DeleteApplicationInputProcessingConfiguration
- DeleteApplicationOutput
- DeleteApplicationReferenceDataSource
- DeleteApplicationSnapshot
- DeleteApplicationVpcConfiguration
- DescribeApplication
- DescribeApplicationSnapshot
- DiscoverInputSchema
- ListApplications
- ListApplicationSnapshots
- StartApplication
- StopApplication
- UpdateApplication
AddApplicationCloudWatchLoggingOption
次のAddApplicationCloudWatchLoggingOptionアクションのリクエストコード例では、Managed Service for Apache Flink アプリケーションに Amazon CloudWatch ログ記録オプションを追加します。
{ "ApplicationName": "MyApplication", "CloudWatchLoggingOption": { "LogStreamARN": "arn:aws:logs:us-east-1:123456789123:log-group:my-log-group:log-stream:My-LogStream" }, "CurrentApplicationVersionId": 2 }
AddApplicationInput
次のAddApplicationInputアクションのリクエストコード例では、アプリケーション入力を Managed Service for Apache Flink アプリケーションに追加します。
{ "ApplicationName": "MyApplication", "CurrentApplicationVersionId": 2, "Input": { "InputParallelism": { "Count": 2 }, "InputSchema": { "RecordColumns": [ { "Mapping": "$.TICKER", "Name": "TICKER_SYMBOL", "SqlType": "VARCHAR(50)" }, { "SqlType": "REAL", "Name": "PRICE", "Mapping": "$.PRICE" } ], "RecordEncoding": "UTF-8", "RecordFormat": { "MappingParameters": { "JSONMappingParameters": { "RecordRowPath": "$" } }, "RecordFormatType": "JSON" } }, "KinesisStreamsInput": { "ResourceARN": "arn:aws:kinesis:us-east-1:012345678901:stream/ExampleInputStream" } } }
AddApplicationInputProcessingConfiguration
次のAddApplicationInputProcessingConfigurationアクションのリクエストコード例では、アプリケーション入力処理設定を Managed Service for Apache Flink アプリケーションに追加します。
{ "ApplicationName": "MyApplication", "CurrentApplicationVersionId": 2, "InputId": "2.1", "InputProcessingConfiguration": { "InputLambdaProcessor": { "ResourceARN": "arn:aws:lambda:us-east-1:012345678901:function:MyLambdaFunction" } } }
AddApplicationOutput
次のAddApplicationOutputアクションのリクエストコード例では、アプリケーション出力として Kinesis データストリームを Managed Service for Apache Flink アプリケーションに追加します。
{ "ApplicationName": "MyApplication", "CurrentApplicationVersionId": 2, "Output": { "DestinationSchema": { "RecordFormatType": "JSON" }, "KinesisStreamsOutput": { "ResourceARN": "arn:aws:kinesis:us-east-1:012345678901:stream/ExampleOutputStream" }, "Name": "DESTINATION_SQL_STREAM" } }
AddApplicationReferenceDataSource
次のAddApplicationReferenceDataSourceアクションのリクエストコード例では、CSVアプリケーションリファレンスデータソースを Managed Service for Apache Flink アプリケーションに追加します。
{ "ApplicationName": "MyApplication", "CurrentApplicationVersionId": 5, "ReferenceDataSource": { "ReferenceSchema": { "RecordColumns": [ { "Mapping": "$.TICKER", "Name": "TICKER", "SqlType": "VARCHAR(4)" }, { "Mapping": "$.COMPANYNAME", "Name": "COMPANY_NAME", "SqlType": "VARCHAR(40)" }, ], "RecordEncoding": "UTF-8", "RecordFormat": { "MappingParameters": { "CSVMappingParameters": { "RecordColumnDelimiter": " ", "RecordRowDelimiter": "\r\n" } }, "RecordFormatType": "CSV" } }, "S3ReferenceDataSource": { "BucketARN": "arn:aws:s3:::amzn-s3-demo-bucket", "FileKey": "TickerReference.csv" }, "TableName": "string" } }
AddApplicationVpcConfiguration
次のAddApplicationVpcConfigurationアクションのリクエストコード例では、既存のアプリケーションにVPC設定を追加します。
{ "ApplicationName": "MyApplication", "CurrentApplicationVersionId": 9, "VpcConfiguration": { "SecurityGroupIds": [ "sg-0123456789abcdef0" ], "SubnetIds": [ "subnet-0123456789abcdef0" ] } }
CreateApplication
次のCreateApplicationアクションのリクエストコード例では、Apache Flink アプリケーション用の Managed Service を作成します。
{ "ApplicationName":"MyApplication", "ApplicationDescription":"My-Application-Description", "RuntimeEnvironment":"FLINK-1_15", "ServiceExecutionRole":"arn:aws:iam::123456789123:role/myrole", "CloudWatchLoggingOptions":[ { "LogStreamARN":"arn:aws:logs:us-east-1:123456789123:log-group:my-log-group:log-stream:My-LogStream" } ], "ApplicationConfiguration": { "EnvironmentProperties": {"PropertyGroups": [ {"PropertyGroupId": "ConsumerConfigProperties", "PropertyMap": {"aws.region": "us-east-1", "flink.stream.initpos": "LATEST"} }, {"PropertyGroupId": "ProducerConfigProperties", "PropertyMap": {"aws.region": "us-east-1"} }, ] }, "ApplicationCodeConfiguration":{ "CodeContent":{ "S3ContentLocation":{ "BucketARN":"arn:aws:s3:::amzn-s3-demo-bucket", "FileKey":"myflink.jar", "ObjectVersion":"AbCdEfGhIjKlMnOpQrStUvWxYz12345" } }, "CodeContentType":"ZIPFILE" }, "FlinkApplicationConfiguration":{ "ParallelismConfiguration":{ "ConfigurationType":"CUSTOM", "Parallelism":2, "ParallelismPerKPU":1, "AutoScalingEnabled":true } } } }
CreateApplicationSnapshot
次のCreateApplicationSnapshotアクションのリクエストコード例では、アプリケーション状態のスナップショットを作成します。
{ "ApplicationName": "MyApplication", "SnapshotName": "MySnapshot" }
DeleteApplication
次のDeleteApplicationアクションのリクエストコード例では、Apache Flink アプリケーションの Managed Service を削除します。
{"ApplicationName": "MyApplication", "CreateTimestamp": 12345678912}
DeleteApplicationCloudWatchLoggingOption
次のDeleteApplicationCloudWatchLoggingOptionアクションのリクエストコード例では、Managed Service for Apache Flink アプリケーションから Amazon CloudWatch ログ記録オプションを削除します。
{ "ApplicationName": "MyApplication", "CloudWatchLoggingOptionId": "3.1" "CurrentApplicationVersionId": 3 }
DeleteApplicationInputProcessingConfiguration
次のDeleteApplicationInputProcessingConfigurationアクションのリクエストコード例では、 Managed Service for Apache Flink アプリケーションから入力処理設定を削除します。
{ "ApplicationName": "MyApplication", "CurrentApplicationVersionId": 4, "InputId": "2.1" }
DeleteApplicationOutput
次のDeleteApplicationOutputアクションのリクエストコード例では、Managed Service for Apache Flink アプリケーションからアプリケーション出力を削除します。
{ "ApplicationName": "MyApplication", "CurrentApplicationVersionId": 4, "OutputId": "4.1" }
DeleteApplicationReferenceDataSource
次のDeleteApplicationReferenceDataSourceアクションのリクエストコード例では、Managed Service for Apache Flink アプリケーションからアプリケーションリファレンスデータソースを削除します。
{ "ApplicationName": "MyApplication", "CurrentApplicationVersionId": 5, "ReferenceId": "5.1" }
DeleteApplicationSnapshot
次のDeleteApplicationSnapshotアクションのリクエストコード例では、アプリケーション状態のスナップショットを削除します。
{ "ApplicationName": "MyApplication", "SnapshotCreationTimestamp": 12345678912, "SnapshotName": "MySnapshot" }
DeleteApplicationVpcConfiguration
次のDeleteApplicationVpcConfigurationアクションのリクエストコード例では、アプリケーションから既存のVPC設定を削除します。
{ "ApplicationName": "MyApplication", "CurrentApplicationVersionId": 9, "VpcConfigurationId": "1.1" }
DescribeApplication
次のDescribeApplicationアクションのリクエストコード例は、Apache Flink アプリケーション用の Managed Service に関する詳細を返します。
{"ApplicationName": "MyApplication"}
DescribeApplicationSnapshot
次のDescribeApplicationSnapshotアクションのリクエストコード例は、アプリケーション状態のスナップショットに関する詳細を返します。
{ "ApplicationName": "MyApplication", "SnapshotName": "MySnapshot" }
DiscoverInputSchema
次のDiscoverInputSchemaアクションのリクエストコード例では、ストリーミングソースからスキーマを生成します。
{ "InputProcessingConfiguration": { "InputLambdaProcessor": { "ResourceARN": "arn:aws:lambda:us-east-1:012345678901:function:MyLambdaFunction" } }, "InputStartingPositionConfiguration": { "InputStartingPosition": "NOW" }, "ResourceARN": "arn:aws:kinesis:us-east-1:012345678901:stream/ExampleInputStream", "S3Configuration": { "BucketARN": "string", "FileKey": "string" }, "ServiceExecutionRole": "string" }
次のDiscoverInputSchemaアクションのリクエストコード例では、リファレンスソースからスキーマを生成します。
{ "S3Configuration": { "BucketARN": "arn:aws:s3:::amzn-s3-demo-bucket", "FileKey": "TickerReference.csv" }, "ServiceExecutionRole": "arn:aws:iam::123456789123:role/myrole" }
ListApplications
次のListApplicationsアクションのリクエストコード例では、アカウント内の Managed Service for Apache Flink アプリケーションのリストを返します。
{ "ExclusiveStartApplicationName": "MyApplication", "Limit": 50 }
ListApplicationSnapshots
次のListApplicationSnapshotsアクションのリクエストコード例は、アプリケーション状態のスナップショットのリストを返します。
{"ApplicationName": "MyApplication", "Limit": 50, "NextToken": "aBcDeFgHiJkLmNoPqRsTuVwXyZ0123" }
StartApplication
次のStartApplicationアクションのリクエストコード例は、Apache Flink アプリケーション用の Managed Service を起動し、最新のスナップショットからアプリケーションの状態をロードします (存在する場合)。
{ "ApplicationName": "MyApplication", "RunConfiguration": { "ApplicationRestoreConfiguration": { "ApplicationRestoreType": "RESTORE_FROM_LATEST_SNAPSHOT" } } }
StopApplication
次のAPI_StopApplicationアクションのリクエストコード例は、Apache Flink アプリケーションの Managed Service を停止します。
{"ApplicationName": "MyApplication"}
UpdateApplication
次のUpdateApplicationアクションのリクエストコード例では、Managed Service for Apache Flink アプリケーションを更新して、アプリケーションコードの場所を変更します。
{"ApplicationName": "MyApplication", "CurrentApplicationVersionId": 1, "ApplicationConfigurationUpdate": { "ApplicationCodeConfigurationUpdate": { "CodeContentTypeUpdate": "ZIPFILE", "CodeContentUpdate": { "S3ContentLocationUpdate": { "BucketARNUpdate": "
arn:aws:s3:::amzn-s3-demo-bucket
", "FileKeyUpdate": "my_new_code.zip
", "ObjectVersionUpdate": "2" } } } }