GCP Part 1 - Connecting to Google Cloud Platform
This chapter describes step-by-step procedure for connecting deviceWISE to Google Cloud Platform.
Make sure that you have a project created on the Google Cloud Platform (GCP). If you do not have a project already created, go to https://cloud.google.com/ and follow the guide to create a project. There are two types of authentications for GCP on deviceWISE, User Account and Service Account.
User Account | Service Account |
---|---|
Use OAuth for a single user to access the API. This authentication requires an access to a web browser that will authenticate your credentials before receiving the OAuth token. | Uses a key string (JSON) to allow access from multiple instances, simultaneously. This authentication requires the JSON file to be stored in a secured place. The Json needs to be in the staging directory on the deviceWISE node. |
Ensure that the project has Cloud Resource Manager API enabled. To see more details about the step by step of enabling it, check the dropdown bellow.
This section will demonstrate how to enable the Cloud Resource Manager API at the User Account.
-
Go to API & Services -> Enabled APIs & services
-
Click on + Enable APIs and Services
-
Search for Cloud Resource Manager API, click the option under Marketplace
-
Enable the product.
This section will demonstrate connection by an OAuth user credentials that need to be used when accessing as a User Account
- Login to https://cloud.google.com/ and go to the Cloud Console.
- Click Google Cloud Platform > API & Services > Credentials.
Credentials screen appears. - Click CREATE CREDENTIALS > OAuth client ID.
- Click Application type drop-down and select Desktop app
- Enter a name in the Name field.
OAuth Client created screen appears. - Copy Your Client ID and Your Client Secret.
Your Client ID and Your Client Secret will be used while setting up the deviceWISE.
Before staring to setup the deviceWISE, make sure you have the latest version of deviceWISE gateway and Workbench installed on your machine. Additionally, install Google Cloud Platform on your deviceWISE. For more information on installing packages, see Packages.
- Under the selected node, click Google Cloud to bring up the console.
Make sure the BigQuery and PubSub corresponding to GCP Scope are selected. - Click the Account Type drop-down and select User Account.
GCP license key must be available in the Licenses. For more information on Licenses, see Licenses. - Paste the Client ID and Client Secret from the GCP in the respective fields.
- Click Get URL.
The OAuth Link is generated. - Open an internet browser (Chrome, IE, or Edge).
- Paste the URL(OAuth Link) in the address bar
- Press Enter to allow the connection.
- If prompted, login to your Google account.
- If a warning message is displayed stating that This app isn't verified, click Advanced > Go to deviceWISE.
- On the subsequent screens, click Allow to grant deviceWISE necessary permissions to connect to GCP.
A code is displayed. - Click the copy icon adjacent to the code to copy the code.
- Paste the code from GCP in the Access Token field.
- Click Connect. The connection status changes to Connected.If you disconnect at any point, you need to regenerate a new OAuth Link to generate a new Access Token.
This section demonstrates connecting through a Service Account.
- Login to https://cloud.google.com/ and go to the Cloud Console.
- Click Google Cloud Platform > IAM & Admin > Service Accounts.
Credentials screen appears. - Click CREATE SERVICE ACCOUNT.
Create service account screen appears. - Enter a name in the Service account name field.
- Click Create.
Service account permissions (optional) screen appears. - Click Select a role drop-down, search and select BigQuery Admin.
- Click ADD ANOTHER ROLE.
- Click Select a role drop-down, search and select Pub/Sub Admin.
- Click CONTINUE.
Grant users access to this service account (optional) screen appears. - Click Done.
- Click on the new account that is created.
Service account details screen appears. - Under Keys, click the drop-down ADD KEY and select Create new key
A screen appears that allows you to chose a Key type (JSON and P12). - Select the default JSON key type.
- Click CREATE.
The JSON (Private key) is saved to your computer.
Before staring to setup the deviceWISE, make sure that you have the latest version of deviceWISE gateway and Workbench installed on your machine. Additionally, install Google Cloud Platform on your deviceWISE. For more information on installing packages, see Packages.
- Open the Workbench.
- Go to Staging Browser.
- Click Put.
- Select the JSON (Private key) you downloaded in the previous section and upload.
- Click Google Cloud to bring up the console.
- Click the Account Type drop-down and select Service Account.
- Click the browse and select the JSON file.
- Click Connect.
The connection status changes to Connected.