允许用户写入对gcp数据流项目的访问权限

时间:2017-03-31 16:26:53

标签: google-cloud-platform google-cloud-dataflow

关注quickstart for gcp dataflow here

执行example script here

时遇到以下错误

使用此命令

declare -r PROJECT="beam-test"
declare -r BUCKET="gs://my-beam-test-bucket"

echo
set -v -e

python -m apache_beam.examples.wordcount \
  --project $PROJECT \
  --job_name $PROJECT-wordcount \
  --runner DataflowRunner \
  --staging_location $BUCKET/staging \
  --temp_location $BUCKET/temp \
  --output $BUCKET/output

会导致此错误:

 http_response.request_url, method_config, request)
apitools.base.py.exceptions.HttpError: HttpError accessing <https://dataflow.googleapis.com/v1b3/projects/beam-test/locations/us-central1/jobs?alt=json>: response: <{'status': '403', 'content-length': '284', 'x-xss-protection': '1; mode=block', 'x-content-type-options': 'nosniff', 'transfer-encoding': 'chunked', 'vary': 'Origin, X-Origin, Referer', 'server': 'ESF', '-content-encoding': 'gzip', 'cache-control': 'private', 'date': 'Fri, 31 Mar 2017 15:52:54 GMT', 'x-frame-options': 'SAMEORIGIN', 'alt-svc': 'quic=":443"; ma=2592000; v="37,36,35"', 'content-type': 'application/json; charset=UTF-8'}>, content <{
  "error": {
    "code": 403,
    "message": "(f010d95b3e221bbf): Could not create workflow; user does not have write access to project: beam-test Causes: (f010d95b3e221432): Permission 'dataflow.jobs.create' denied on project: 'beam-test'",
    "status": "PERMISSION_DENIED"

我已经为项目启用了DataFlow API。我已经使用项目的所有者帐户授权gcloud cli(我假设它具有完全访问权限)。

&amp;我在哪里启用写权限?

2 个答案:

答案 0 :(得分:6)

$PROJECT=project-name更改为$PROJECT=project-id

答案 1 :(得分:1)

您是否尝试过运行gcloud auth login以确保您拥有有效的凭据?

如果是,您的默认云项目可能与您运行Dataflow的项目不同。要更改默认项目,您可以运行gcloud init

如果这不能解决,请告诉我。