Amazon Managed Service for Apache Flink 之前称为 Amazon Kinesis Data Analytics for Apache Flink。
本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
为适用于 Apache Flink Studio 笔记本的托管服务创建自定义IAM策略
您通常使用托管IAM策略来允许您的应用程序访问相关资源。如果您需要对应用程序的权限进行更精细的控制,则可以使用自定义IAM策略。本节包含自定义IAM策略的示例。
注意
在以下策略示例中,将占位符文本替换为应用程序的值。
AWS Glue
以下示例策略授予访问 AWS Glue 数据库的权限。
{ "Version": "2012-10-17", "Statement": [ { "Sid": "GlueTable", "Effect": "Allow", "Action": [ "glue:GetConnection", "glue:GetTable", "glue:GetTables", "glue:GetDatabase", "glue:CreateTable", "glue:UpdateTable" ], "Resource": [ "arn:aws:glue:
<region>:<accountId>
:connection/*", "arn:aws:glue:<region>:<accountId>
:table/<database-name>
/*", "arn:aws:glue:<region>:<accountId>
:database/<database-name>
", "arn:aws:glue:<region>:<accountId>
:database/hive", "arn:aws:glue:<region>:<accountId>
:catalog" ] }, { "Sid": "GlueDatabase", "Effect": "Allow", "Action": "glue:GetDatabases", "Resource": "*" } ] }
CloudWatch 日志
以下策略授予访问 CloudWatch 日志的权限:
{ "Sid": "ListCloudwatchLogGroups", "Effect": "Allow", "Action": [ "logs:DescribeLogGroups" ], "Resource": [ "arn:aws:logs:
<region>
:<accountId>
:log-group:*" ] }, { "Sid": "ListCloudwatchLogStreams", "Effect": "Allow", "Action": [ "logs:DescribeLogStreams" ], "Resource": [ "<logGroupArn>
:log-stream:*" ] }, { "Sid": "PutCloudwatchLogs", "Effect": "Allow", "Action": [ "logs:PutLogEvents" ], "Resource": [ "<logStreamArn>
" ] }
注意
如果您使用控制台创建应用程序,则控制台会向您的应用程序角色添加访问 CloudWatch 日志所需的策略。
Kinesis Streams
您的应用程序可以使用 Kinesis Stream 作为源或目标。您的应用程序需要读取权限才能从源流中读取数据,需要写入权限才能写入目标流。
以下策略授予从用作来源的 Kinesis Stream 中进行读取的权限:
{ "Version": "2012-10-17", "Statement": [ { "Sid": "KinesisShardDiscovery", "Effect": "Allow", "Action": "kinesis:ListShards", "Resource": "*" }, { "Sid": "KinesisShardConsumption", "Effect": "Allow", "Action": [ "kinesis:GetShardIterator", "kinesis:GetRecords", "kinesis:DescribeStream", "kinesis:DescribeStreamSummary", "kinesis:RegisterStreamConsumer", "kinesis:DeregisterStreamConsumer" ], "Resource": "arn:aws:kinesis:
<region>:<accountId>
:stream/<stream-name>
" }, { "Sid": "KinesisEfoConsumer", "Effect": "Allow", "Action": [ "kinesis:DescribeStreamConsumer", "kinesis:SubscribeToShard" ], "Resource": "arn:aws:kinesis:<region>
:<account>
:stream/<stream-name>
/consumer/*" } ] }
以下策略授予写入用作目标的 Kinesis Stream 的权限:
{ "Version": "2012-10-17", "Statement": [ { "Sid": "KinesisStreamSink", "Effect": "Allow", "Action": [ "kinesis:PutRecord", "kinesis:PutRecords", "kinesis:DescribeStreamSummary", "kinesis:DescribeStream" ], "Resource": "arn:aws:kinesis:
<region>
:<accountId>
:stream/<stream-name>
" } ] }
如果您的应用程序访问加密的 Kinesis 流,则必须授予访问该流的额外权限和该流的加密密钥。
以下策略授予访问加密源流的权限和直播的加密密钥:
{ "Sid": "ReadEncryptedKinesisStreamSource", "Effect": "Allow", "Action": [ "kms:Decrypt" ], "Resource": [ "
<inputStreamKeyArn>
" ] } ,
以下策略授予访问加密目标流的权限和直播的加密密钥:
{ "Sid": "WriteEncryptedKinesisStreamSink", "Effect": "Allow", "Action": [ "kms:GenerateDataKey" ], "Resource": [ "
<outputStreamKeyArn>
" ] }
亚马逊MSK集群
要授予对 Amazon MSK 集群的访问权限,您需要授予对该集群的访问权限VPC。有关访问 Amazon 的策略示例VPC,请参阅VPC应用程序权限。