BTP Cloud Foundry Part 1: Orgs, Spaces, Apps and Services
Lessons are open to try during our launch period. Some advanced content may move to Pro later. AI practice limits apply separately.
Cloud Foundry is BTP's application runtime for buildpack-based apps. Learn orgs and spaces, space roles, how cf push turns code into a running app with buildpacks and routes, and how apps consume BTP services through service instances and bindings.
In this lessonShow sectionsHide sections
Visual overview
The situation: a real project scenario
A new developer put database credentials into a config file in Git. Moving to a bound HANA service instance with credentials read from VCAP_SERVICES removed the secret from source control.
Explanation
This series on Cloud Foundry covers orgs, spaces, apps and services, deploying with manifests and MTAs, and lifecycle, bindings and configuration across three parts — this lesson is the first. Each subaccount that has Cloud Foundry enabled gets exactly one org, and spaces inside that org are what actually separate different applications and services from each other.
Space roles, such as Space Developer, control who is allowed to deploy and manage applications within a given space. Running cf push uploads your code, a buildpack then builds and runs it, and a route gives the resulting application a reachable URL.
Applications consume services — XSUAA, destination, HANA, and others — through service instances that get bound to the app, with the resulting credentials showing up in the VCAP_SERVICES environment variable. The clear principle here is that service credentials belong in bindings, never hard-coded in application code or configuration files.
Available space roles include Org Manager, Space Manager, Space Developer and Space Auditor, each with a different scope of control. Buildpacks exist for Node.js, Java and Python, among other runtimes. Running cf apps and cf services regularly is a simple habit that shows exactly what's currently running and what it's bound to.
Giving Space Developer access in production to every developer bypasses whatever deployment control process is supposed to govern production changes.
In practice, this means logging in with cf login and targeting a space, pushing a sample application, and then creating and binding a service instance — the goal being that the application's environment actually shows the service credentials it was bound to.
Expert visual walkthrough
Cloud Foundry resources
Cloud Foundry · Chapter-specific technical teaching map
Architecture hierarchy
BTP subaccount
Cloud Foundry org
Space
Apps and services
Tutor's chapter takeaway
Cloud Foundry is BTP's application runtime for buildpack-based apps. Learn orgs and spaces, space roles, how cf push turns code into a running app with buildpacks and routes, and how apps consume BTP services through service instances and bindings.
In a real project
A new developer put database credentials into a config file in Git. Moving to a bound HANA service instance with credentials read from VCAP_SERVICES removed the secret from source control.
Watch out for
• Putting service credentials directly in code or config files instead of using bindings exposes secrets in source control — always consume credentials from the service binding (VCAP_SERVICES). • Granting broad space roles…
Code example
===== CF CLI =====cf login -a https://api.cf.eu10.hana.ondemand.com # authenticates against the Cloud Foundry API endpoint for your regioncf target -o acme-dev -s dev # selects which org and space subsequent commands apply tocf push my-app # uploads and starts the app using manifest.yml in the current directorycf create-service xsuaa application my-xsuaa # provisions an XSUAA service instance for authenticationcf bind-service my-app my-xsuaa && cf restage my-app # binds the service (injects credentials into VCAP_SERVICES) and restarts the app to pick them upcf env my-app # shows VCAP_SERVICEScf apps | cf services | cf logs my-app --recent # lists apps, lists service instances, tails recent logsWatch out
Common mistakes
- Putting service credentials directly in code or config files instead of using bindings exposes secrets in source control — always consume credentials from the service binding (VCAP_SERVICES).
- Granting broad space roles (e.g. Space Developer) to everyone in production bypasses deployment control — apply least-privilege space roles.
- Forgetting to restage an app after changing its service bindings means it keeps using stale credentials — always restage after a binding change.
- Running every team and environment out of one Cloud Foundry space makes isolation and cleanup difficult — use separate spaces per stage or team.
- Ignoring application logs delays discovering problems that are already visible in cf logs — check logs as part of routine troubleshooting.
Do this
Best practices
- Consume service credentials through bindings (VCAP_SERVICES), never hard-coded in code or config.
- Apply least-privilege space roles, especially in production.
- Restage apps after any service binding change to pick up new credentials.
- Use separate spaces per deployment stage or team.
- Check application logs (cf logs) regularly as part of troubleshooting.
In the interview
Interview angle
Questions: "Org vs space?", "What does a buildpack do?", "How does an app get service credentials?"
Strong answer: org/space/roles, push and buildpacks, routes, services and bindings.
Practice this lesson
Quick check
0 of 3 questions attempted
Question 1 of 3
How many Cloud Foundry orgs does a BTP subaccount have when Cloud Foundry is enabled?
Question 2 of 3
Which Cloud Foundry space role grants a user permission to push applications, manage service instances, and view logs within a specific space, without granting org-wide administrative rights?
Question 3 of 3
In Cloud Foundry, what determines the URL through which an external client can reach a deployed application?
Practise this in an interview
Answer in your own words and get instant feedback, the way an interviewer would judge it.
1What are the core concepts of Cloud Foundry, and how would you explain them clearly in an SAP interview?
2A new developer stored database credentials in a config file. Explain how Cloud Foundry apps should get service credentials.
See it in code
Each example starts from a requirement, shows the design, then the code step by step with a plain-language explanation of every part.
Was this lesson helpful?
Keep exploring
Interview questions on this topic
Check before use: lesson examples are educational, not a guarantee of correctness for your SAP edition or release. Sample code has not been executed on your SAP system. Confirm API availability, syntax, authorizations and business impact in an approved development or test environment.