Developing APIs/Microservices in Cloud Foundry and Managing through API Management
In this blog, I will explain, challenges and advantages of SAP Cloud Platform API Management on Cloud Foundry Stack and how SAP Cloud Platform API Management enables you to manage your digital assets on Cloud Foundry.
Introduction of SAP Cloud Platform API Management on Cloud Foundry
Going forward more and more APIs will be built in cloud foundry as microservices, also using Cloud Extension SDK. In that cases, API Management capabilities that cover API lifecycle(Design, Develop, Manage, Analytics and Engage) is critical. SAP Cloud Platform API Management enables you to manage your digital assets on Cloud Foundry. It acts as a service broker in the Cloud Foundry marketplace that can be used to create an instance and connect to your existing Neo subscription. You can then bind your Cloud Foundry application to the created service instance which automatically creates an API Proxy in your API Portal
For more details refer blog1 and blog2
Challenges
- How can we govern APIs, Microservices, Applications build in cloud foundry?
- How can we provide API lifecycle management in cloud foundry?
- How can we get statistics of APIs build in cloud foundry?
- How can cloud foundry APIs be combined with other managed APIs in API Product and published to Developer Portal?
- How can cloud foundry developers find endpoints, test, subscribe and use it.
Solution and Benefits
SAP Cloud Platform API Management as Service Broker on Cloud Foundry enables the following:
1. Manages microservices/APIs/applications on Cloud Foundry Stack
2. Enables API Governance in Cloud Foundry
3. Provides API Lifecycle Management in Cloud Foundry
4. Helps in developer engagement.
High-level Architecture
Pre-Requisites
- Install cf cli (https://docs.cloudfoundry.org/cf-cli/install-go-cli.html#windows)
- Cloud Foundry trial account in Frankfurt
- Neo trial account with API management service
Creating an API Management Service Instance
Log-on to trial cockpit https://account.hanatrial.ondemand.com/cockpit and click on Cloud Foundry Trial.Select the region and click OK
Wait for its processing and then click on Go to Space.
Navigate to Services and then to Service Marketplace and Search for API Management
Click on the tile and Navigate to instance
Fill the specified parameters as shown and click on next
Click on Next fill the details and leave the application name as blank and save it.
Creating Cloud Foundry application
To create and deploy Cloud Foundry application refer following links
- https://lethalbrains.com/deploying-a-node-js-and-mongodb-application-in-sap-cloud-platform-6920ad3ca98a
- https://github.com/SAP/hcp-cloud-foundry-tutorials
- https://github.com/cloudfoundry-samples?utf8=%E2%9C%93&q=node&type=&language=
Deploying and Binding your Cloud Foundry Application
Login to your Cloud Foundry space via the Command Line Interface (CLI). Invoke the following route service binding command to create the API Proxy in your Neo subscription.
cf bind-route-service sap-cf-domain.com apim-service-instance-name –hostname my-cf-app -c ‘{“api_name” : ”custom_api_proxy_name”}’
For Eg: cf bind-route-service cfapps.sap.hana.ondemand.com APIMServiceInstance –hostname eProductStore
Note: The api_name is an optional parameter in case you want a custom name for your API Proxy. Else it is created with an auto-generated name.
With this, all calls to your application will be routed through API Management and an API Proxy gets created in your API Portal.
Managing in API Portal
You could go ahead and add Policies to bring in additional security or control traffic, quota etc.
In order to allow or deny access of the API to specific client IP or IP ranges access control policy can be used. This is done in the following blog entry.
Further Reads
- API Security Best Practices Blog Series
- For more blogs on SAP Cloud Platform, API Management visit us at SCN
Note: With the latest 13B delivery we improved the mechanism, all existing and new trial accounts should be entitled to trial APIMservices.
There are 3 additional steps:
1.Open HANA trial cockpit and Navigate to Cloud Foundry Trial.
2. Select Entitlements, from services select “Expose your data and processes as APIs for omni-channel consumption and manage the lifecycle of those APIs”.
Select Service plan as lite.
3. Now you should be able to see API Management Service
Shilpa Vij
Not sure if i missed something, i don't find "API Management" under Services> Service Marketplace in my SCP trial account.
Regards,
JK
same here...
Regards,
Tamas
Hello Jitendra,
You can try creating one more user and with that user login to SCP (Frankfurt trial).
Regards
Shilpa
With my new trial user, i can now see "API Management"
(for my other p-user, CF trial account was expired, i extended it but still cant see "API Management" over there)
When specifying parameters, here's the JSON for copy-and-paste:
Shilpa
I am using hana cloud foundry trial account. In the services I dont find API management but I can do the same in the Integration Suite API management. However I found that when we use Developer portal to create an application we get an error
https://blogs.sap.com/2021/01/10/cloud-foundry-api-portal-and-cpi-api-using-a-premise-odata-service/
I could use all the features of CPI and API on an Premise version and create a Product but not the application - Can you kindly pass this to the dev ops or support team for the Cloud foundry trail
Best regards
Ramesh