简体   繁体   English

如何将GCP数据流作为服务帐户运行

[英]How to run GCP Dataflow as a Service Account

Right now when I kick off the dataflow it kicks it off as my UserName. 现在,当我启动数据流时,它将以我的用户名启动。 Is there a way to run the GCP Dataflow as a service account? 有没有一种方法可以将GCP数据流作为服务帐户运行? If so, can you provide any samples? 如果可以,您可以提供任何样品吗?

Much Appreciated! 非常感激!

To set up service account based authentication: 设置基于服务帐户的身份验证:

In the GCP Console, go to the Create service account key page. 在GCP控制台中,转到“创建服务帐户密钥”页面。 Here 这里

From the Service account list, select New service account. 从服务帐户列表中,选择新服务帐户。 In the Service account name field, enter a name. 在服务帐户名称字段中,输入名称。 From the Role list, select Project > Owner. 从角色列表中,选择项目>所有者。

Note: The Role field authorizes your service account to access resources. 注意:“角色”字段授权您的服务帐户访问资源。 You can view and change this field later by using the GCP Console. 您以后可以使用GCP控制台查看和更改此字段。 If you are developing a production app, specify more granular permissions than Project > Owner. 如果要开发生产应用程序,请指定比“项目”>“所有者”更多的细化权限。 For more information, see granting roles to service accounts. 有关更多信息,请参阅授予服务帐户角色。

Click Create. 单击创建。

A JSON file that contains your key downloads to your computer. 包含密钥下载的JSON文件到您的计算机。

Set the environment variable GOOGLE_APPLICATION_CREDENTIALS to the file path of the JSON file that contains your service account key. 将环境变量GOOGLE_APPLICATION_CREDENTIALS设置为包含您的服务帐户密钥的JSON文件的文件路径。 This variable only applies to your current shell session, so if you open a new session, set the variable again. 该变量仅适用于当前的Shell会话,因此,如果您打开一个新的会话,请再次设置该变量。

You can get more information from here : https://cloud.google.com/dataflow/docs/quickstarts/quickstart-python 您可以从这里获取更多信息: https : //cloud.google.com/dataflow/docs/quickstarts/quickstart-python

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM