Amazon Managed Service for Apache Flink(Amazon MSF)는 이전에 Amazon Kinesis Data Analytics for Apache Flink로 알려져 있었습니다.
Managed Service for Apache Flink API 예 코드
이 항목에는 Managed Service for Apache Flink 작업을 위한 예 요청 블록이 포함되어 있습니다.
AWS Command Line Interface(AWS CLI)와 함께 작업을 위한 입력으로 JSON을 사용하려면 요청을 JSON 파일에 저장하십시오. 그런 다음 --cli-input-json 파라미터를 사용하여 파일 명칭을 작업에 전달합니다.
다음 예에서는 작업과 함께 JSON 파일을 사용하는 방법을 보여줍니다.
$ aws kinesisanalyticsv2 start-application --cli-input-json file://start.json
AWS CLI과 함께 JSON을 사용하는 방법에 대한 자세한 내용을 알아보려면 AWS Command Line Interface 사용자 가이드의 CLI Skeleton 및 CLI 입력 JSON 파라미터 생성을 참조하십시오.
주제
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
ApplicationInputProcessingConfiguration 작업을 위한 다음 예 요청 코드는 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 작업을 위한 다음 예 요청 코드는 Managed Service for Apache Flink 애플리케이션에 CSV 애플리케이션 참조 데이터 소스를 추가합니다.
{ "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 작업을 위한 다음 예 요청 코드는 Managed Service for Apache Flink 애플리케이션을 생성합니다.
{ "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 작업을 위한 다음 예 요청 코드는 Managed Service for Apache Flink 애플리케이션을 삭제합니다.
{"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 작업을 위한 다음 예 요청 코드는 Managed Service for Apache Flink에 대한 세부 정보를 반환합니다.
{"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
ListApplication Snapshots 작업을 위한 다음 예 요청 코드는 애플리케이션 상태의 스냅샷 목록을 반환합니다.
{"ApplicationName": "MyApplication", "Limit": 50, "NextToken": "aBcDeFgHiJkLmNoPqRsTuVwXyZ0123" }
StartApplication
StartApplication 작업을 위한 다음 예 요청 코드는 Managed Service for Apache Flink 애플리케이션을 시작하고 최신 스냅샷(있는 경우)에서 애플리케이션 상태를 로드합니다.
{ "ApplicationName": "MyApplication", "RunConfiguration": { "ApplicationRestoreConfiguration": { "ApplicationRestoreType": "RESTORE_FROM_LATEST_SNAPSHOT" } } }
StopApplication
API_StopApplication 작업을 위한 다음 예 요청 코드는 Managed Service for Apache Flink를 중지합니다.
{"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" } } } }