Overview
You will learn
- How to create a service instance at the subaccount level using the btp CLI
- How to mark a service instance as shared
- How to verify that the reference-instance plan is available
Prerequisites
- In Choose a Service Sharing Method, you chose instance sharing.
- The service you want to share is entitled in your subaccount.
- You have the Subaccount Administrator role collection.
- You have installed and configured the btp CLI.
Steps
Intro
This tutorial is service-agnostic and uses SAP Cloud Logging as example. You can use any service whose plan supports standard instance sharing; for a list of supported services and which use service-specific methods instead, see Sharing SAP BTP Services.
Throughout this tutorial, the commands use placeholder values. Replace them with the values for your chosen service:
| Placeholder | Description | Example (SAP Cloud Logging) |
|---|---|---|
<SERVICE_NAME> | The technical name of the service offering | cloud-logging |
<PLAN_NAME> | The technical name of the service plan | standard |
<INSTANCE_NAME> | A name you choose for your instance | my-shared-cls |
<SUBACCOUNT_ID> | The ID of your subaccount (go to your subaccount’s Overview page and find it under General Information) | a1b2c3d4-… |
To find the technical names of services and plans available in your subaccount, run:
btp list services/offering --subaccount <SUBACCOUNT_ID>
btp list services/plan --subaccount <SUBACCOUNT_ID>Create the source service instance at the subaccount level with the btp CLI (rather than a runtime-specific tool). This way, you decouple the instance from the runtime’s lifecycle, so that disabling the runtime on that subaccount doesn’t affect the service instance.
To create the instance, run:
Shellbtp create services/instance --subaccount <SUBACCOUNT_ID> --offering-name <SERVICE_NAME> --plan-name <PLAN_NAME> --name <INSTANCE_NAME>To verify that the instance was created, run:
Shellbtp get services/instance --subaccount <SUBACCOUNT_ID> --name <INSTANCE_NAME>The output shows the instance details, including its
id. You need this value later to establish the reference pointer. You can retrieve it at any time by with this command.
Tip: Some services need configuration parameters at creation time. If your service needs parameters, add
--parameters <JSON_OR_FILE>to the create command. Check the service’s documentation for required parameters.
To make the instance available for reference from other scopes, mark it as shared.
Run:
btp share services/instance --subaccount <SUBACCOUNT_ID> --name <INSTANCE_NAME>This command marks the instance as shared in SAP Service Manager. Also, it makes a new service plan named reference-instance available for the service. When you consume the shared service, you use this plan to create pointers to the shared instance.
To confirm that the instance is shared, run:
Shellbtp get services/instance --subaccount <SUBACCOUNT_ID> --name <INSTANCE_NAME>In the output, verify that the
sharedproperty istrue.To confirm that the
reference-instanceplan is available, run:Shellbtp list services/plan --subaccount <SUBACCOUNT_ID> --offering-name <SERVICE_NAME>The output must include a plan named
reference-instance. If it doesn’t, verify that the instance is shared and that the service plan supports sharing.
You now have a shared service instance that other scopes can reference. Depending on your target runtime, continue with:
Question 1: Why is it recommended to create the shared instance using the btp CLI rather than a runtime-specific tool?
- The btp CLI is faster.
- It decouples the instance from any single runtime’s lifecycle. [CORRECT]
- Runtime-specific tools don’t support instance creation.
- The btp CLI automatically shares the instance.
Question 2: What happens when you share a service instance?
- A copy of the instance is created in every space.
- The instance credentials are sent to all subaccount administrators.
- A
reference-instanceplan becomes available for the service. [CORRECT] - The instance is moved to the global account level.
Question 3: How do you confirm that the reference-instance plan is available after sharing?
- Run
btp list services/planand check thatreference-instanceappears in the output [CORRECT] - Run
btp get services/instanceand check thatsharedistrue - Run
btp share services/instanceagain to refresh the plan list - Check the SAP BTP cockpit under Service Instances
Resources
Discussion
Share feedback on this tutorial or join the conversation in SAP Community.