A healthy software project has a well-developed software development life cycle (SDLC) that helps coordinate efforts across individuals and teams. It is important to separate your different testing environments, for example Development, Production, and QA. With a traditional configuration housed in a private data center, this is often done using different sets of hardware or virtual servers for each phase.

AppFog, CenturyLink’s Platform-as-a-Service (PaaS) based on Cloud Foundry, provides all the tools necessary for isolating environments required by your SDLC. In addition to that, AppFog leads to more efficient sharing of application resources during the development, testing, and production phases. That means you reap the benefits of significant infrastructure and labor cost savings.


Before you can deploy anything to AppFog, you need to sign-up for a CenturyLink Cloud account and enable AppFog. If you are ready to get started, but are not yet a CenturyLink Cloud customer, no problem. Get started on CenturyLink Cloud with a free trial. Try our most popular products, or MarketPlace Partners offerings, allowing you to create a combination of products that best fits your business needs.

In order to get the most out of this tutorial, you'll want to know the basics of AppFog. For a deeper dive into how AppFog works, check out this Knowledge Base article. To learn about deploying popular PHP frameworks to AppFog, check out this series of articles.

Tools Used

AppFog allows you to host cloud-native applications easily without worrying about provisioning, maintaining servers, and separate services. AppFog applications deploy quickly, scale automatically, and give you access to the full range of CenturyLink Cloud products.

Introducing Cloud Foundry Spaces

AppFog uses role-based access control (RBAC) to grant permission to individual application deployment targets. Every AppFog application and service is tied to a space. That space provides AppFog users with a shared location for application deployment and maintenance. Each space can have its own RBAC rules, resource allocation, and configuration. For instance, you could have specific members in a Developer space that don't have access to manage the Production space.

Creating a New Space

To create a new space, log into your CenturyLink Cloud account and navigate to the Control Portal. Then, follow the directions below.

wNew Space

  1. Select a region from the left-side navigation. The regions are circled in red in the screen shot.
  2. Click create space.
  3. Enter a name for the new space in the form. Create Space
  4. Click create space.

Managing Space Membership

To manage the RBAC configuration for AppFog spaces, you will need to log into your CenturyLink Cloud account and navigate to the Control Portal. To select a space and add a members to it, follow these steps: New Space

  1. Select a region from the left-side navigation. The regions are circled in red in the above screen shot.
  2. Select a space from the left-side navigation or from the SPACE list on the region screen. These two areas are circled in green in the screen shot.
  3. Select the Members tab.
  4. To give a user access to the space, click add a member.
  5. Fill in the user name and check mark the roles the user will have. These roles grant permissions in the space and are assigned per user, per space. Add Member
  6. Click add member to finish the member configuration process.

Accessing Spaces from the Command Line

Once you have your AppFog spaces configured you can use them to deploy and manage independent instances of your applications.

Keeping Separate Manifests

You cannot specify space-specific configuration parameters in an AppFog manifest file. The best way to maintain your application's deployment is to maintain a separate manifest for each space. There are a several reasons why this is needed.

  • Since application names need to be unique across all of AppFog, it is necessary to define a different name in each manifest.
  • Applications in different environments probably require different resources. For example, an application in the development stage will need fewer instances and less memory than a production application.
  • The applications in different spaces will also connect to different AppFog services.

In the examples below, we name our manifest files according to the spaces they are used in. For example, manifest-Tutorial.yaml is used with the "Tutorial" space, while manifest-Dev.yaml is used with the "Dev" space.

Deploying to a Space

The Cloud Foundry Command Line Interface (CLI) targets one specific space at a time. To deploy an application to a specific space, follow these steps. In the commands below, replace {DeploymentSpace} with the name of your deployment space.

  1. Find out what space the CLI is targeting with the cf target command, like this:
    cf target
    Dev Target
  2. If the space doesn't match your deployment space, you can change the deployment space using this command:

    $ cf target -s {DeploymentSpace}
  3. Finally, deploy your application using your customized manifest file.

    $ cf push -f manifest-{DeploymentSpace}.yaml

Creating a Service in a Space

AppFog services are tied to spaces, as well. This means that your development application cannot accidentally connect to your production database services, keeping your different environments pristine. To create a service in a space, you need to make sure you target it with the cf target command, as in Steps 1 and 2 from Deploying to a Space above.

For example, to provision an Orchestrate instance in the "Tutorial" space, use these commands:

$ cf target -s Tutorial
$ cf create-service orchestrate free orchestrate-tutorial-instance

Managing Spaces from the Command Line

The Cloud Foundry CLI provides the tools necessary to manage AppFog spaces from the command line. You can create, delete, or rename spaces. You can also administer the user permissions in each space.

  • To create a space, use the cf create-space command.
  • To delete a space, use the cf delete-space command.
  • To rename a space, use the command: cf rename-space {SpaceName} {NewSpaceName}.

Replace {SpaceName} with the current name of the space, and {NewSpaceName} with the new name.

AppFog Spaces and Your SDLC

The specifics of how AppFog spaces will work for your team depend on the details of your SDLC. A typical setup might include a space for development, a space for testing, and a space for production. Each team member would be given a username and password to log into the Cloud Foundry CLI. These individual usernames also allow the administrator to restrict permissions to each space. This way, your developers won't accidentally launch production applications and your QA team won't be able to accidentally delete developer sandbox applications.

Larger shops might benefit from creating individual spaces for each development team, software property, or SDLC stage. In addition to segregation of duties and powerful permissions control, AppFog spaces are great for understanding how many resources are being used by each team and deployed application.


AppFog spaces offer the ability to compartmentalize development, testing, and deployment procedures to facilitate all aspects of SDLC plans. Learn more about AppFog, its intuitive GUI, and powerful CLI options on our Developer Center blog and our library of Knowledge Base articles.

Sign-up for our Developer-focused newsletter CODE. It's designed hands-on by developers, for developers. Keep up-to-date on topics of interest: tutorials, tips and tricks, and community building events.

We’re a different kind of cloud provider – let us show you why.