Amazon Managed Service for Apache Flink(Amazon MSF)之前称为 Amazon Kinesis Data Analytics for Apache Flink。
使用 Managed Service for Apache Flink VPC API
使用以下 Managed Service for Apache Flink API 操作来管理应用程序的 VPC。有关使用 Managed Service for Apache Flink API 的信息,请参阅Managed Service for Apache Flink API 示例代码。
创建应用程序
在创建期间,可以使用 创建应用程序 操作将 VPC 配置添加到应用程序中。
CreateApplication 操作的以下示例请求代码在创建应用程序时包括 VPC 配置:
{ "ApplicationName":"MyApplication", "ApplicationDescription":"My-Application-Description", "RuntimeEnvironment":"FLINK-1_15", "ServiceExecutionRole":"arn:aws:iam::123456789123:role/myrole", "ApplicationConfiguration": { "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 } },"VpcConfigurations": [ { "SecurityGroupIds": [ "sg-0123456789abcdef0" ], "SubnetIds": [ "subnet-0123456789abcdef0" ] } ]} }
AddApplicationVpcConfiguration
在创建应用程序后,可以使用 AddApplicationVpcConfiguration 操作将 VPC 配置添加到应用程序中。
AddApplicationVpcConfiguration 操作的以下示例请求代码将 VPC 配置添加到现有应用程序中:
{ "ApplicationName": "MyApplication", "CurrentApplicationVersionId": 9, "VpcConfiguration": { "SecurityGroupIds": [ "sg-0123456789abcdef0" ], "SubnetIds": [ "subnet-0123456789abcdef0" ] } }
DeleteApplicationVpcConfiguration
可以使用 DeleteApplicationVpcConfiguration 操作从应用程序中删除 VPC 配置。
AddApplicationVpcConfiguration 操作的以下示例请求代码从应用程序中删除现有的 VPC 配置:
{ "ApplicationName": "MyApplication", "CurrentApplicationVersionId": 9, "VpcConfigurationId": "1.1" }
更新应用程序
可以使用 UpdateApplication 操作同时更新应用程序的所有 VPC 配置。
UpdateApplication 操作的以下示例请求代码更新应用程序的所有 VPC 配置:
{ "ApplicationConfigurationUpdate": { "VpcConfigurationUpdates": [ { "SecurityGroupIdUpdates": [ "sg-0123456789abcdef0" ], "SubnetIdUpdates": [ "subnet-0123456789abcdef0" ], "VpcConfigurationId": "2.1" } ] }, "ApplicationName": "MyApplication", "CurrentApplicationVersionId": 9 }