forked from pivotal-cf/docs-google
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathusing.html.md.erb
381 lines (269 loc) · 14.9 KB
/
using.html.md.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
---
breadcrumb: PCF Services
title: Using GCP Service Broker
---
This topic describes how developers set up, operate, and scale Google Cloud Platform (GCP) resources from Pivotal Cloud Foundry (PCF) by creating and managing service instances using the GCP Service Broker.
The procedures in this topic require the [Cloud Foundry Command Line Interface](http://docs.pivotal.io/pivotalcf/cf-cli/index.html) (cf CLI).
##<a id="view"></a>View Services
1. In a terminal window, run `cf marketplace` to list the available GCP Service Broker services.
1. Run `cf marketplace -s SERVICE` to view the descriptions for the plans of a service.
<p class="note"><strong>Note</strong>: To view pricing details for each service, see the <a href="https://cloud.google.com/pricing/#details">GCP Pricing</a> topic.</p>
##<a id="create"></a>Create Service Instances
This section describes how to create instances of each of the services supported by the GCP Service Broker.
###<a id="storage"></a>Google Cloud Storage
#### Create
Run `cf create-service google-storage` to create a new bucket. The following example creates a bucket named `mybucket` with the `standard` plan:
<pre class="terminal">$ cf create-service google-storage standard mybucket
</pre>
You can optionally specify the following parameters:
* `name`: If not supplied, is autogenerated and provided on bind.
* `location`: Defaults to `us`.
#### Bind
Bind the `google-storage` service to an app to create a new service account and private key. The following example creates a service account with the minimum necessary permissions to view bucket objects.
For more information, see the [GCP Understanding Roles](https://cloud.google.com/iam/docs/understanding-roles) topic.
<pre class="terminal">$ cf bind-service myapp mybucket -c '{"role": "storage.objectViewer"}'
</pre>
<p class="note"><strong>Note</strong>: Run <code>cf unbind-service</code> to delete the service account and key created when binding.</p>
**Example Binding credentials**
<pre>"credentials": {
"Email": "redacted",
"Name": "redacted",
"PrivateKeyData": "redacted",
"UniqueId": "redacted",
"bucket_name": "foobar",
}
</pre>
###<a id="storage"></a>Google Cloud Datastore
#### Create
Run `cf create-service google-datastore` to create a new database instance and database.
<pre class="terminal">$ cf create-service google-datastore default mydatabase
</pre>
#### Bind
Bind the `google-datastore` service to an app to create a new service account and private key.
The following example creates a service account with the `datastore.user` role.
For more information, see the [GCP Understanding Roles](https://cloud.google.com/iam/docs/understanding-roles) topic.
<pre class="terminal">$ cf bind-service myapp mydatabase
</pre>
<p class="note"><strong>Note</strong>: Run <code>cf unbind-service</code> to delete the service account and key created when binding.</p>
**Example Binding credentials**
<pre>"credentials": {
"Email": "redacted",
"Name": "redacted",
"PrivateKeyData": "redacted",
"UniqueId": "redacted",
"dataset_id": "foobar",
}
</pre>
###<a id="bigquery"></a>Google BigQuery
#### Create
Run `cf create-service google-bigquery` to create a new dataset. The following example creates a dataset named `mydataset` with the `default` plan:
<pre class="terminal">$ cf create-service google-bigquery default mydataset
</pre>
You can optionally specify the following parameters:
* `name`: If not supplied, is autogenerated and provided on bind.
#### Bind
Bind the `google-bigquery` service to an app to create a new service account and private key.
The following example creates a service account with the minimum necessary permissions to view datasets.
For more information, see the [GCP Understanding Roles](https://cloud.google.com/iam/docs/understanding-roles) topic.
<pre class="terminal">$ cf bind-service myapp mydataset -c '{"role": "bigquery.dataViewer"}'
</pre>
<p class="note"><strong>Note</strong>: Run <code>cf unbind-service</code> to delete the service account and key created when binding.</p>
**Example Binding credentials**
<pre>"credentials": {
"Email": "redacted",
"Name": "redacted",
"PrivateKeyData": "redacted",
"UniqueId": "redacted",
"dataset_id": "foobar",
}
</pre>
###<a id="pubsub"></a>Google PubSub
#### Create
Run `cf create-service google-pubsub` to create a new topic and optional subscription. The following example creates a topic named `mytopic` and a pull subscription named `mysubscription` with the `default` plan:
<pre class="terminal">$ cf create-service google-pubsub default mypubsub
</pre>
You can optionally specify the following parameters:
* `topic_name`: If not supplied, is autogenerated and provided on bind.
* `subscription_name`
* `is_push`: Defaults to false.
* `endpoint`: Used when `is_push` = `true`. Defaults to `nil`.
* `ack_deadline`: In seconds. Defaults to `10`, with a maximum of `600`.
#### Bind
Bind the `google-pubsub` service to an app to create a new service account and private key. The following example creates a service account with minimum necessary permissions to view topics and subscriptions.
For more information, see the [GCP Understanding Roles](https://cloud.google.com/iam/docs/understanding-roles) topic.
<pre class="terminal">$ cf bind-service myapp mypubsub -c '{"role": "pubsub.viewer"}'
</pre>
<p class="note"><strong>Note</strong>: Run <code>cf unbind-service</code> to delete the service account and key created when binding.</p>
**Example Binding credentials**
<pre>"credentials": {
"Email": "redacted",
"Name": "redacted",
"PrivateKeyData": "redacted",
"UniqueId": "redacted",
"topic\_name": "foobar",
"subscription_name": "empty\_if\_not\_set",
}
</pre>
###<a id="cloudsql"></a>Google Cloud SQL
#### Create
Run `cf create-service google-cloudsql` to create a new database instance and database. PCF Operators create custom plans for Google Cloud SQL when installing the GCP Service Broker. The following example creates an instance named `myinstance` and a database named `mydb` with a custom `d4_standard` plan:
<pre class="terminal">$ cf create-service google-cloudsql d4\_standard mycloudsql
</pre>
<p class="note"><strong>Note</strong>: Google Cloud SQL uses asynchronous provisioning.</p>
You can optionally specify the following parameters:
* `instance_name`: If not supplied, is autogenerated and provided on bind.
* `database_name`: If not supplied, is autogenerated and provided on bind.
* `version`: Defaults to `MYSQL_5_6` for First Generation MySQL instances, `MYSQL_5_7` for Second Generation MySQL instances, or `POSTGRES_9_6` for PostgreSQL instances.
* `disk_size`: In GB. Only for 2nd gen. Defaults to `10`.
* `region`: Defaults to `us-central`.
* `zone`: Only for 2nd gen.
* `disk_type`: Only for 2nd gen. Defaults to `ssd`.
* `failover_replica_name`: Only for 2nd gen. Creates a failover replica if specified. Defaults to `""`.
* `maintenance_window_day`: Only for 2nd gen. Defaults to `1`, which is Sunday.
* `maintenance_window_hour`: Only for 2nd gen. Defaults to `0`.
* `backups_enabled` Defaults to `true`. Set to `false` to disable.
* `backup_start_time`: Defaults to `06:00`.
* `binlog`: Defaults to `false` for 1st gen, `true` for 2nd gen. Set to `true` to use.
* `activation_policy`: Defaults to on demand.
* `replication_type`: Defaults to `synchronous`.
* `auto_resize`: Only for 2nd gen. Defaults to `false`. Set to `true` to use.
#### Bind
Bind the `google-cloudsql` service to an app to create a new user and set of ssl certs. The following example creates a new user and ssl certs.
<pre class="terminal">$ cf bind-service myapp mycloudsql
</pre>
You can optionally specify the following parameters:
* `username`: If not supplied, is autogenerated.
* `password`: If not supplied, is autogenerated.
<p class="note"><strong>Note</strong>: Run <code>cf unbind-service</code> to delete this user and invalidate the created ssl certs.</p>
**Example Binding credentials**
<pre>"credentials": {
"CaCert": "-----BEGIN CERTIFICATE-----\nredacted\n-----END CERTIFICATE-----",
"ClientCert": "-----BEGIN CERTIFICATE-----\nredacted\n-----END CERTIFICATE-----",
"ClientKey": "-----BEGIN EXAMPLE RSA PRIVATE KEY-----\redacted\n-----END EXAMPLE RSA PRIVATE KEY-----",
"Password": "unencoded-redacted",
"Sha1Fingerprint": "redacted",
"Username": "redacted",
"database\_name": "redacted",
"host": "255.255.255.255",
"instance\_name": "redacted",
"last\_master\_operation_id": "some-guid",
"uri": "mysql://username:encodedpassword@host/databasename?ssl\_mode=required"
}
</pre>
###<a id="google-mlapis"></a>Google Machine Learning APIs
#### Create
Using `cf create-service` to create an instance of `google-ml-apis` does not create any resources. This service is for bindings only.
It is likely that this implementation will change in the future.
<pre class="terminal">$ cf create-service google-ml-apis default mymlapis
</pre>
#### Bind
Bind the `google-mlapis` service to an app to create a new service account and private key. The following example creates a service account with the minimum necessary permissions to use the Machine Learning APIs.
For more information, see the [GCP Understanding Roles](https://cloud.google.com/iam/docs/understanding-roles) topic.
<pre class="terminal">$ cf bind-service myapp mymlapis -c '{"role": "viewer"}'
</pre>
<p class="note"><strong>Note</strong>: Run <code>cf unbind-service</code> to delete the service account and key created when binding.</p>
**Example Binding credentials**
<pre>"credentials": {
"Email": "redacted",
"Name": "redacted",
"PrivateKeyData": "redacted",
"UniqueId": "redacted",
}
</pre>
###<a id="bigtable"></a>Google Bigtable
#### Create
Run `cf create-service google-bigtable` to create a new instance. The following example creates an instance named `mybtinstance` with a custom `bigtable-small`:
<pre class="terminal">$ cf create-service google-bigtable bigtable-small mybtinstance
</pre>
You can optionally specify the following parameters:
* `name`: If not supplied, is autogenerated and provided on bind.
* `cluster_id`
* `num_nodes`: An integer between `3` and `30`. Defaults to `3`.
* `storage_type`: Either `HDD` or `SSD`. Defaults to `SSD`.
* `zone`: Defaults to `us-east1-b`.
#### Bind
Bind the `google-bigtable` service to an app to create a new service account and private key. The following example creates a service account with admin permissions.
For more information, see the [GCP Understanding Roles](https://cloud.google.com/iam/docs/understanding-roles) topic.
<pre class="terminal">$ cf bind-service myapp mybtinstance -c '{"role": "bigtable.admin"}'
</pre>
<p class="note"><strong>Note</strong>: Run <code>cf unbind-service</code> to delete the service account and key created when binding.</p>
**Example Binding credentials**
<pre>"credentials": {
"Email": "redacted",
"Name": "redacted",
"PrivateKeyData": "redacted",
"UniqueId": "redacted",
"instance_id": "redacted"
}
</pre>
###<a id="spanner"></a>Google Spanner (BETA Google Service)
#### Create
Run `cf create-service google-spanner` to create a new instance. The following example creates an instance named `myspinstance` with a custom `spanner-default` plan:
<pre class="terminal">$ cf create-service google-spanner spanner-default myspinstance
</pre>
You can optionally specify the following parameters:
* `name`: If not supplied, is autogenerated and provided on bind.
* `display_name`: If not supplied, is autogenerated.
* `region`: Defaults to `regional-us-central1`.
#### Bind
Bind the `google-spanner` service to an app to create a new service account and private key. The following example creates a service account with admin permissions.
For more information, see the [GCP Understanding Roles](https://cloud.google.com/iam/docs/understanding-roles) topic.
<pre class="terminal">$ cf bind-service myapp myspinstance -c '{"role": "spanner.admin"}'
</pre>
<p class="note"><strong>Note</strong>: Run <code>cf unbind-service</code> to delete the service account and key created when binding.</p>
**Example Binding credentials**
<pre>"credentials": {
"Email": "redacted",
"Name": "redacted",
"PrivateKeyData": "redacted",
"UniqueId": "redacted",
"instance_id": "redacted"
}
</pre>
###<a id="google-stackdriver-debugger"></a>Stackdriver Debugger
#### Create
Using `cf create-service` to create an instance of `google-stackdriver-debugger` does not create any resources. This service is for bindings only.
<pre class="terminal">$ cf create-service google-stackdriver-debugger default my-debugger
</pre>
#### Bind
Bind the `google-stackdriver-debugger` service to an app to create a new service account and private key. The following example creates a service account with the minimum necessary permissions to act as a Stackdriver Debugger Agent.
For more information, see the [GCP Understanding Roles](https://cloud.google.com/iam/docs/understanding-roles) topic.
<pre class="terminal">$ cf bind-service myapp my-debugger
</pre>
<p class="note"><strong>Note</strong>: Run <code>cf unbind-service</code> to delete the service account and key created when binding.</p>
**Example Binding credentials**
<pre>"credentials": {
"Email": "redacted",
"Name": "redacted",
"PrivateKeyData": "redacted",
"UniqueId": "redacted",
}
</pre>
###<a id="google-stackdriver-trace"></a>Stackdriver Trace
#### Create
Using `cf create-service` to create an instance of `google-stackdriver-trace` does not create any resources. This service is for bindings only.
<pre class="terminal">$ cf create-service google-stackdriver-trace default my-tracer
</pre>
#### Bind
Bind the `google-stackdriver-trace` service to an app to create a new service account and private key. The following example creates a service account with the minimum necessary permissions to act as a Stackdriver Trace Agent.
For more information, see the [GCP Understanding Roles](https://cloud.google.com/iam/docs/understanding-roles) topic.
<pre class="terminal">$ cf bind-service myapp my-tracer
</pre>
<p class="note"><strong>Note</strong>: Run <code>cf unbind-service</code> to delete the service account and key created when binding.</p>
**Example Binding credentials**
<pre>"credentials": {
"Email": "redacted",
"Name": "redacted",
"PrivateKeyData": "redacted",
"UniqueId": "redacted",
}
</pre>
##<a id="delete"></a>Delete a Service Instance
<p class="note"><strong>Note</strong>: Before deleting a service instance, ensure there are no apps bound to the service instance and no data contained within, such as objects in a storage bucket.</p>
Run the following command to delete a service instance:
<pre class="terminal">$ cf delete-service YOUR-SERVICE-INSTANCE
Really delete the service YOUR-SERVICE-INSTANCE> y
Deleting service YOUR-SERVICE-INSTANCE in org system / space dev1 as appdev1...
OK
Delete in progress. Use 'cf services' or 'cf service YOUR-SERVICE-INSTANCE' to check operation status.
</pre>