Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
amita_patnaik
Explorer
Hi All,

SAP Cloud Platform with Cloud Foundry offers us the flexibility to choose the underlying cloud infrastructure  - Amazon Web Service , AZURE and Google Cloud Platform.

I am a Senior developer in SAP and am working in project using SAP CloudPlatform Cloud foundry hosted on Amazon Web service infrastructure. Based on my first hand experience, i thought of posting some technical information on this topic which might be useful to users, who are new to the platform and are looking for answers.

In this blog,I will explain in detail on 2 topics:

  • Sharing the tenant database with the other spaces in the global account via Cloud cockpit.

  • Creating a service instance from a space having the permissions on the tenant database and  binding it to an application via Cloud cockpit or CLI.


Sharing the tenant database with the other spaces in the global account on via Cloud cockpit

Prerequisites:

  • Global account in SAP Cloud foundry on Amazon web service infrastructure.

  •  Dedicated HANA Database available to the global account.

  •  A user assigned to the global account and with SPACE Manager role assigned to it.

  • 1 org and 2 spaces assigned to same org - 1 space having the database with one or more tenant databases and another space that requires permission to use one of the tenant databases.


1. Login with the user to SAP Cloud Platform
https://cloudplatform.sap.com/index.html



2.Login with the user and password

3. SAP Cloud Platform Cockpit page is displayed.



4. Under Cloud Foundry Environment section, click on the tile in which you as an user have a global      account with a Hana database assigned to it.

5. It takes you to a region overview page where your list of global accounts is displayed:



6. Click on your Global Account Name.

7. It takes you to the Sub accounts page overview page listing the sub accounts.



Your  sub account should have at least one org and 2 spaces listed in the org.

8. Click on the Sub account



9. The sub account overview page is displayed with the organization, spaces and member info  under Cloud Foundry section in the right side.

10. Click on the number link next to the Space field.

11. The spaces are displayed in the spaces page with each space displaying information on        Applications, Quota and Members is listed.



13. Click on the Space having the HANA database assigned to it.

14.The selected space overview page is displayed. In the left side, click on SAP HANA from the left context menu to expand it .



 

15. The database system information is displayed in the Database System overview page.



Click on the database system name available in the table. This link will navigate to overview page of the specified database.

User can perform various operations on the database: Restart, Check for updates and Install components through this page. It also gives you the current status of your database with the last update info.



 

16.Click on the Tenant Databases from the Context Menu. The page will display a list of tenant databases created. This page allows one to create a new tenant database.





17. Click on database id's name listed in the table to navigate to overview page for respective tenant database.



Tenant database overview page gives information on the parameters which were selected during the creation of the tenant db.

Link to access SAP HANA Cockpit is enabled if you have selected as one of the options while creating the tenant db from the Tenant Databases page.

18. Click on Permissions from the Context menu.



Available permissions on the spaces for the tenant db are listed in the table. For a new tenant database, this will be empty.

19. To create a new permission, click on New Permissions.



In the popup window, select the space to which you want to grant permissions.

There are two types

  • HANA_SERVICE

  • APPLICATION_ACCESS


Select the two permission and click on OK to save it. A new entry in the permissions page with the info on the assigned permissions gets displayed.

Additional actions that can be carried in the page are editing the existing permissions and deleting it.

For more details on the permissions, refer the sap help documentation:

https://help.sap.com/viewer/d4790b2de2f4429db6f3dff54e4d7b3a/Cloud/en-US/f63a19669a974aba92baf198ada...

This concludes the first part of the blog, about how to provide permissions to a space to enable it for accessing a tenant database residing in another space with an intent for creating service bindings and deploying applications.

 

Creating a service instance from a space having the permissions on the tenant database and  binding it to an application via Cloud cockpit or CLI tool

This can be done via Cloud cockpi or CLI tool

Prerequisite:

  • A space in the global account, with permission granted for using the tenant database residing in another space.

  • An application deployed and running on the CF space.

  • Install CLI tool.


Via Cloud cockpit:

1. Navigate to the space having the permissions on the tenant database by clicking on the Overview link in Context Menu.

2. Click on Spaces from the left panel.



Spaces information under the sub account is displayed in the space overview page.

3. Click on the space link which was granted the permission in the previous blog section.

The application deployed on the space should be available in the Application overview page



4. Click on the Application Name link in the table.



The Application overview page is displayed. The overview page provides information on the application status, application routes, build packs, stack, quota, Instances, Most recent application events.

Operations which can be performed include restart, stop, instance creation, delete and Change quota.

5. Click on Service Bindings from the left panel. List of Service Bindings get displayed.



 

6. Click on Bind Service. Bind Service wizard get displayed.



Select “Service from Catalog” from Choose Service Type option. Click on Next.

 

9. Select “HANA” from Choose Service. Click on Next



 

10.Select “hdi-shared” from Service Plan. Click on Next.



11. Under Specify Parameters section, enter a json string in the textbox.



Syntax :

{           "database_id": "<GUID_owner_space>:<tenant_db_name>"

}

Where <GUID_owner_space>:  Space Guid value.

Space Guid value can be found using the cf command in CLI tool ->

cf space <spaceName> --guid



<tenant_db_name>: Tenant database specified in the cloud cockpit.

Tenant database value can be found in

SAP Cloud Platform Cockpit –> Home -> CF environment -> Org -> Subaccount -> Space ->

Tenant Databases -> Database ID

Click on Next.

12. Enter the Instance Name and click Finish to Confirm.



On successful creation, the service gets created and is displayed in Service Binding page with its Service, Plan and Action details.

Via CLI:

1. Install CLI for your desktop/ laptop OS from the link: https://github.com/cloudfoundry/cli/releases 

2. Unpack the zip file and run the cf executable file. When prompted choose Install.

3. To make sure CLI is installed properly, open the command prompt in windows.

Type cf help.

The command should list a set of available commands for cf.



4. To connect to your Cloud Foundry account,

Enter the command -> cf api <cf_api_endpoint url>

You can get the cf_api_endpoint url, from Sub account overview section of cloud cockpit.



5. Login to your account by typing the command ->

cf login

 6. At UserID prompt, type -> <UserName>

7. At Password prompt, type -> <Password>



8. You are prompted to select an org from the available list of organizations in your sub account.

At Org prompt, type -> <Your Org name> or <Org No>

Targeted space in the Org gets displayed.



 

9. You will be prompted to select a space from the list of spaces in your chosen organization.

Navigate to the space having the permissions to create services on the tenant database.

At the space prompt, type -> <SpaceName> or <Space No>



 

10. To list the services in the org, type the command->

cf s or cf services

11. To create a service, type the command->

cf create-service <SERVICE> <SERVICE PLAN> <SERVICE INSTANCE NAME>

[-c PARAMETERS_AS_JSON] [-t TAGS]

e.g:

cf create-service hana hdi-shared <HANA SERVICE NAME> -c "{\"database_id\":\"<SPACE GUID>:<TENANT DATABASE NAME>\"}"



OK message is displayed if the service is successfully created.

 

To get space guid info, type the command ->

cf space <SPACE NAME> --guid



12. The service created in the space can be checked, by typing the command -> cf s

If permissions are not assigned on the space, then create service command will display an error.

 

13. Bind the service to an application using the command:

cf bind-service APP_NAME SERVICE_INSTANCE [-c PARAMETERS_AS_JSON]



 

This brings us to the end of the blog where the user, knows on how to share a tenant db with the other spaces ; create a service instance from a space having permissions on tenant db and bind it to an application.

I will be sharing more information in my subsequent blogs.

Looking forward to your feedbacks 🙂

Thank You !!

 
7 Comments