ERROR: (gcloud.iot.devices.create) PERMISSION_DENIED

683 Views Asked by At

I keep getting permission denied when trying to do gcloud commands

gcloud iot devices create 'aq-rpi' --project='aqmon' --region='us-central1' --registry='aqmon' --public-key path=rsa_cert.pem,type=rs256

ERROR: (gcloud.iot.devices.create) PERMISSION_DENIED: The caller does not have permission

and

gcloud iam roles list --project aqmon

ERROR: (gcloud.iam.roles.list) User [[email protected]] does not have permission to access project [aqmon] (or it may not exist): You don't have permission to list roles in projects/aqmon.

I am the owner of the project, and the project is a freshly created project that I created via the dashboard.

This is my first time using Google's IoT offerings. I've spent several hours trying different things, but I'm at a loss and unable to move forward with even the basic tutorials for IoT Core. What am I doing wrong?

Edit: Here is the output of gcloud info

my_name@hephaestus:~/Documents/aq$ gcloud info
Google Cloud SDK [225.0.0]

Platform: [Mac OS X, x86_64] ('Darwin', 'hephaestus.local', '17.7.0', 'Darwin Kernel Version 17.7.0: Thu Jun 21 22:53:14 PDT 2018; root:xnu-4570.71.2~1/RELEASE_X86_64', 'x86_64', 'i386')
Python Version: [2.7.10 (default, Oct  6 2017, 22:29:07)  [GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.31)]]
Python Location: [/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python]
Site Packages: [Disabled]

Installation Root: [/Users/my_name/Downloads/google-cloud-sdk]
Installed Components:
  core: [2018.11.09]
  gsutil: [4.34]
  bq: [2.0.37]
System PATH: [/Users/my_name/Downloads/google-cloud-sdk/bin:/Users/my_name/.rvm/gems/ruby-2.2.1/bin:/Users/my_name/.rvm/gems/ruby-2.2.1@global/bin:/Users/my_name/.rvm/rubies/ruby-2.2.1/bin:/Users/my_name/.nvm/versions/node/v8.9.4/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Users/my_name/.rvm/bin:/Users/my_name/.rvm/bin]
Python PATH: [/Users/my_name/Downloads/google-cloud-sdk/lib/third_party:/Users/my_name/Downloads/google-cloud-sdk/lib:/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip:/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/:/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin:/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac:/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages:/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk:/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old:/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload]
Cloud SDK on PATH: [True]
Kubectl on PATH: [False]

Installation Properties: [/Users/my_name/Downloads/google-cloud-sdk/properties]
User Config Directory: [/Users/my_name/.config/gcloud]
Active Configuration Name: [default]
Active Configuration Path: [/Users/my_name/.config/gcloud/configurations/config_default]

Account: [[email protected]]
Project: [aqmon-223120]

Current Properties:
  [core]
    project: [aqmon-12345]
    account: [[email protected]]
    disable_usage_reporting: [False]

Logs Directory: [/Users/my_name/.config/gcloud/logs]
Last Log File: [/Users/my_name/.config/gcloud/logs/2018.11.20/13.49.34.950065.log]

git: [git version 2.17.2 (Apple Git-113)]
ssh: [OpenSSH_7.6p1, LibreSSL 2.6.2]
1

There are 1 best solutions below

1
On BEST ANSWER

You're attempting to use the project name 'aqmon' in your commands, but your project is actually 'aqmon-223120'.