You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let's direct all COS CLI uses to our COS instance:
126
130
```
127
-
$ ibmcloud cos config crn --crn $COS_ID --force
131
+
> ibmcloud cos config crn --crn $COS_INSTANCE_ID --force
128
132
129
133
Saving new Service Instance ID...
130
134
OK
@@ -135,63 +139,75 @@ Now, let's use the "IAM" authentication method which will use the same API Key
135
139
that the rest of our CLI commands will use:
136
140
137
141
```
138
-
$ ibmcloud cos config auth --method IAM
142
+
> ibmcloud cos config auth --method IAM
139
143
140
144
OK
141
145
Successfully switched to IAM-based authentication. The program will access your Cloud Object Storage account using your IAM Credentials.
142
146
```
143
147
148
+
Last, let's set the region for the bucket
149
+
```
150
+
> ibmcloud cos config region --region ${REGION}
151
+
152
+
OK
153
+
Successfully saved default region. The program will look for buckets in the region eu-de.
154
+
```
155
+
144
156
Next, let's go ahead and create a new bucket into which our data will be stored.
145
157
To do this you'll need to provide a unique name for your bucket. It needs to be
146
158
globally unique across all buckets in the IBM Cloud. In the command below
147
159
we'll use our project's ID appended with "-gallery", but you can technically use any value you want as long as it's unique. Let's save that name in an environment variable for
148
160
easy use:
149
161
150
162
```
151
-
$ export BUCKET="$CE_PROJECT_GUID-gallery"
152
-
$ echo "BUCKET: $BUCKET"
163
+
> export BUCKET="$CE_PROJECT_GUID-gallery"
164
+
> echo "BUCKET: $BUCKET"
153
165
```
154
166
155
-
Now let's ask COS to create our bucket:
167
+
Now, let's ask COS to create our bucket:
156
168
157
169
```
158
-
$ ibmcloud cos bucket-create --bucket $BUCKET
170
+
> ibmcloud cos bucket-create --bucket $BUCKET
159
171
160
172
OK
161
173
Details about bucket 91efff97-1001-4144-997a-744ec8009303-gallery:
162
174
Region: eu-de
163
175
Class: Standard
164
176
```
165
177
166
-
To complete this setup, we'll need to adjust the application configuration and make it aware of the persistence store.
178
+
In order to enable the Code Engine app to interact with the COS bucket, we'll create a service credential that contains HMAC credentials, store it in a Code Engine secret and create a persistent data store so that Code Engine components can mount the bucket.
Open the gallery application in your browser. Notice the Gallery title on the right-hand side has slightly changed. It now says `My Gallery hosted on IBM Cloud Object Storage`. Play around with the gallery by adding a few images. Notice, that the gallery images re-appear after reloading the page.
@@ -243,7 +259,7 @@ In order to allow the function to read and write to the bucket, we'll need to cr
243
259
244
260
List all service credentials of the Object Storage instance:
0 commit comments