## 5.6.2.2.1 Service Instance in the Cloud Foundry
## Prerequisites
- Before creating an SAP S/4HANA Cloud Extensibility service instance in the Cloud Foundry environment, see Create a Service Instance to Consume the SAP S/4HANA Cloud APIs [page 2115].
- Have enabled Cloud Foundry environment for your subaccount. See Enable Environment or Create Environment Instance [page 2255].
- Have registered an SAP S/4HANA Cloud system. SeeRegister an SAP S/4HANA Cloud System in a Global Account in SAP BTP [page 2048].
- Have configured the entitlements to the SAP S/4HANA Cloud Extensibility service. See Configure the Entitlements for the SAP S/4HANA Cloud Extensibility Service [page 2114].
## Context
To consume the SAP S/4HANA Cloud APIs (inbound connection) or consume APIs exposed by the extension application from SAP S/4HANA Cloud (outbound connection), you create an SAP S/4HANA Cloud Extensibility service instance. When creating the service instance, you configure the communication arrangement and the authentication type for the connection.
For communication arrangements with inbound connections, a destination on a subaccount level with the same name as the service instance name is automatically created in this subaccount. It contains all instance binding properties which are sufficient to establish connection to the SAP S/4HANA Cloud system.
##  Note
Make sure that you don't already have a destination with the same name as the service instance. If you do, you will not be able to create the service instance.
##  Note
Multitenant applications, that this subaccount is subscribed to, can access the destination and connect to the SAP S/4HANA Cloud system without binding to the created service instance.
See Developing Multitenant Business Applications in the Cloud Foundry Environment.
## Create an SAP S/4HANA Cloud Extensibility Environment
## Procedure
1. In the SAP BTP cockpit, navigate to the subaccount in which you want to create a service instance.
2. In the navigation area, choose Services Service Marketplace .
All services available to you appear.
3. To enable the integration with an SAP S/4HANA Cloud system that you have registered in SAP BTP global account, choose SAP S/4HANA Cloud Extensibility .
4. In the SAP S/4HANA Cloud Extensibility page, choose Create .
5. In the New Instance or Subscription wizard:
- a. In the Service dropdown list, ensure you have selected the SAP S/4HANA Cloud Extensibility service.
- b. In the Plan dropdown list, select the api-access service plan.
- c. In the Runtime Environment dropdown list, select Cloud Foundry .
- d. In the Space dropdown list, select your space. If you haven't create a space yet, you can do it at this point.
- e. In the System Name dropdown list, select the SAP S/4HANA Cloud system you have registered.
- f. In the Instance Name field, enter a name for your instance. Choose Next .
- g. To define the communication arrangement and the authentication type for the API access, specify a JSON file or specify parameters in the JSON format. If you decide to define the communication arrangement and the authentication type later on, you have to delete this service instance and create it again. Choose Next .
For more information about the structure of the JSON file, see Communication Arrangement JSON/ YAML File - Properties [page 2121].
- h. Choose Create .
After you have created the service instance:
- The newly created instance appears in the list of instances in the Instance and Subscriptions page.
- An HTTP destination on a subaccount level with the same name as the service instance name is automatically generated in this subaccount.
Alternatively, you can use the Cloud Foundry Command Line Interface (cf CLI) to create the service instance using the technical name of the SAP S/4HANA Cloud Extensibility service which is s4-hanacloud .
For more information, see Create Service Instances Using the Cloud Foundry Command Line Interface.
<!-- image -->
##  Note
You can use the cf CLI to troubleshoot if the creation of the service instance fails. To do that, use this command in the cf CLI:
cf service &lt;service\_instance\_name&gt;
## Next Steps
After you have created the service instance:
- The newly created instance appears in the list of instances in the Instance and Subscriptions page.
- An HTTP destination on a subaccount level with the same name as the service instance name is automatically generated in this subaccount.
Alternatively, you can use the Cloud Foundry Command Line Interface (cf CLI) to create the service instance using the technical name of the SAP S/4HANA Cloud Extensibility service which is s4-hana-cloud .
For more information, see Create Service Instances Using the Cloud Foundry Command Line Interface.
##  Note
You can use the cf CLI to troubleshoot if the creation of the service instance fails. To do that, use this command in the cf CLI:
cf service &lt;service\_instance\_name&gt;
After creating the SAP S/4HANA Cloud Extensibility service instance, you have the following options for configuring the connectivity for your extension application:
- Bind the instance to an application, and it will be assigned an access URL and credentials to the corresponding API. For more information about binding applications to service instances, see Binding Service Instances to Applications in the SAP BTP documentation.
- Consume the automatically generated destination.
To consume the destination, you use the destination service. You can either consume the Destination service directly, or configure the application router to consume it.
##  Note
The name of the destination is the same as the name of the service instance you have created.
- For more information about consuming the destination service using the application router, see Application Routes and Destinations.
- For more information about consuming the destination service directly, see Consuming the Destination Service (Cloud Foundry Environment).