2. Understand your Bluemix account

In this section, you will use the Bluemix command-line interface tool to work with Bluemix and understand your Bluemix account, organization, and spaces for applications. You use this tool in a terminal on your workstation.

    1. Start a command terminal or Git Bash shell window.
      The Bluemix command-line tool is not supported by Cygwin and the windows command prompt should be used instead of the Cygwin bash shell. The examples shown are from a Mac OS X bash command prompt.
    2. Verify your CLI release by running this command: bx –v
    3. Select the Bluemix region for your login by providing the API endpoint to the bx api command.
      This table shows the regions and associated API endpoints.

      Region API endpoint
      US South https://api.ng.bluemix.net
      United Kingdom https://api.eu-gb.bluemix.net
      Sydney https://api.au-syd.bluemix.net
      Germany https://api.eu-de.bluemix.net

      For examle, to select the US South region, enter:
      bx api https://api.ng.bluemix.net

    4. Log in to Bluemix after setting the endpoint:
      bx login -u user_name -o org_name -s space_name
      Then, enter your Bluemix password that you use to sign in to the Bluemix web UI. If you skip any options, the command will prompt for you to provide them to complete the login.
      If you see a warning or failed login with a message like “You are using a federated user ID, please use one time passcode,” add the --sso option to the login command to be provided with a URL for creating a one-time passcode for the login.
      The login sequence shown gives an example of a user that has a federated ID and needs to use a one-time passcode. When your Bluemix account is initially created, you get an opportunity to customize the name of the organization and set a space name. Organization names must be unique across Bluemix. Space names do not need to be unique
    5. List your current spaces in Bluemix by using the bx iam spaces Add a space to your current organization by using bx iam space-create myNewSpace and then list the spaces in your organization by using bx iam spaces.
      Commands related to applications and services, for example, deploying an application, will operate within the current organization and space. To change the active space, use the bx target command and provide the new space with the –s option. This command might also be used to change the current active organization.
    6. View your quota. Resource limits are set in the organization level. To view quota available in an organization that you are a member of, enter bx iam org <yourOrgName>

Unless you want to use it for the rest of this lab, you can delete the space that you added above with the following command: bx iam space-delete myNewSpace