|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// * backup_and_restore/application_backup_and_restore/installing/installing-oadp-ibm-cloud.adoc |
| 4 | + |
| 5 | +:_mod-docs-content-type: PROCEDURE |
| 6 | +[id="configuring-ibm-cos_{context}"] |
| 7 | += Configuring the COS instance |
| 8 | + |
| 9 | +You create an {ibm-cloud-object-storage} instance to store the {oadp-short} backup data. After you create the COS instance, configure the `HMAC` service credentials. |
| 10 | + |
| 11 | +.Prerequisites |
| 12 | + |
| 13 | +* You have an {ibm-cloud-title} Platform account. |
| 14 | +* You installed the link:https://cloud.ibm.com/docs/cli?topic=cli-getting-started[{ibm-cloud-title} CLI]. |
| 15 | +* You are logged in to {ibm-cloud-title}. |
| 16 | +
|
| 17 | +.Procedure |
| 18 | + |
| 19 | +. Install the {ibm-cloud-object-storage} plugin by running the following command: |
| 20 | ++ |
| 21 | +[source,terminal] |
| 22 | +---- |
| 23 | +$ ibmcloud plugin install cos -f |
| 24 | +---- |
| 25 | + |
| 26 | +. Set a bucket name by running the following command: |
| 27 | ++ |
| 28 | +[source,terminal] |
| 29 | +---- |
| 30 | +$ BUCKET=<bucket_name> |
| 31 | +---- |
| 32 | + |
| 33 | +. Set a bucket region by running the following command: |
| 34 | ++ |
| 35 | +[source,terminal] |
| 36 | +---- |
| 37 | +$ REGION=<bucket_region> <1> |
| 38 | +---- |
| 39 | +<1> Specify the bucket region, for example, `eu-gb`. |
| 40 | + |
| 41 | +. Create a resource group by running the following command: |
| 42 | ++ |
| 43 | +[source,terminal] |
| 44 | +---- |
| 45 | +$ ibmcloud resource group-create <resource_group_name> |
| 46 | +---- |
| 47 | + |
| 48 | +. Set the target resource group by running the following command: |
| 49 | ++ |
| 50 | +[source,terminal] |
| 51 | +---- |
| 52 | +$ ibmcloud target -g <resource_group_name> |
| 53 | +---- |
| 54 | + |
| 55 | +. Verify that the target resource group is correctly set by running the following command: |
| 56 | ++ |
| 57 | +[source,terminal] |
| 58 | +---- |
| 59 | +$ ibmcloud target |
| 60 | +---- |
| 61 | ++ |
| 62 | +.Example output |
| 63 | ++ |
| 64 | +[source,yaml] |
| 65 | +---- |
| 66 | +API endpoint: https://cloud.ibm.com |
| 67 | +Region: |
| 68 | +User: test-user |
| 69 | +Account: Test Account (fb6......e95) <-> 2...122 |
| 70 | +Resource group: Default |
| 71 | +---- |
| 72 | ++ |
| 73 | +In the example output, the resource group is set to `Default`. |
| 74 | + |
| 75 | +. Set a resource group name by running the following command: |
| 76 | ++ |
| 77 | +[source,terminal] |
| 78 | +---- |
| 79 | +$ RESOURCE_GROUP=<resource_group> <1> |
| 80 | +---- |
| 81 | +<1> Specify the resource group name, for example, `"default"`. |
| 82 | + |
| 83 | +. Create an {ibm-cloud-title} `service-instance` resource by running the following command: |
| 84 | ++ |
| 85 | +[source,terminal] |
| 86 | +---- |
| 87 | +$ ibmcloud resource service-instance-create \ |
| 88 | +<service_instance_name> \// <1> |
| 89 | +<service_name> \// <2> |
| 90 | +<service_plan> \// <3> |
| 91 | +<region_name> // <4> |
| 92 | +---- |
| 93 | +<1> Specify a name for the `service-instance` resource. |
| 94 | +<2> Specify the service name. Alternatively, you can specify a service ID. |
| 95 | +<3> Specify the service plan for your {ibm-cloud-title} account. |
| 96 | +<4> Specify the region name. |
| 97 | ++ |
| 98 | +.Example command |
| 99 | ++ |
| 100 | +[source,terminal] |
| 101 | +---- |
| 102 | +$ ibmcloud resource service-instance-create test-service-instance cloud-object-storage \ // <1> |
| 103 | +standard \ |
| 104 | +global \ |
| 105 | +-d premium-global-deployment // <2> |
| 106 | +---- |
| 107 | +<1> The service name is `cloud-object-storage`. |
| 108 | +<2> The `-d` flag specifies the deployment name. |
| 109 | + |
| 110 | +. Extract the service instance ID by running the following command: |
| 111 | ++ |
| 112 | +[source,terminal] |
| 113 | +---- |
| 114 | +$ SERVICE_INSTANCE_ID=$(ibmcloud resource service-instance test-service-instance --output json | jq -r '.[0].id') |
| 115 | +---- |
| 116 | + |
| 117 | +. Create a COS bucket by running the following command: |
| 118 | ++ |
| 119 | +[source,terminal] |
| 120 | +---- |
| 121 | +$ ibmcloud cos bucket-create \// |
| 122 | +--bucket $BUCKET \// |
| 123 | +--ibm-service-instance-id $SERVICE_INSTANCE_ID \// |
| 124 | +--region $REGION |
| 125 | +---- |
| 126 | ++ |
| 127 | +Variables such as `$BUCKET`, `$SERVICE_INSTANCE_ID`, and `$REGION` are replaced by the values you set previously. |
| 128 | + |
| 129 | +. Create `HMAC` credentials by running the following command. |
| 130 | ++ |
| 131 | +[source,terminal] |
| 132 | +---- |
| 133 | +$ ibmcloud resource service-key-create test-key Writer --instance-name test-service-instance --parameters {\"HMAC\":true} |
| 134 | +---- |
| 135 | + |
| 136 | +. Extract the access key ID and the secret access key from the `HMAC` credentials and save them in the `credentials-velero` file. You can use the `credentials-velero` file to create a `secret` for the backup storage location. Run the following command: |
| 137 | ++ |
| 138 | +[source,terminal] |
| 139 | +---- |
| 140 | +$ cat > credentials-velero << __EOF__ |
| 141 | +[default] |
| 142 | +aws_access_key_id=$(ibmcloud resource service-key test-key -o json | jq -r '.[0].credentials.cos_hmac_keys.access_key_id') |
| 143 | +aws_secret_access_key=$(ibmcloud resource service-key test-key -o json | jq -r '.[0].credentials.cos_hmac_keys.secret_access_key') |
| 144 | +__EOF__ |
| 145 | +---- |
0 commit comments