Using services

Use the command line to create and manage services such as remote databases.

Command

Description

af services

Lists available and configured services for your account.

af create-service [service]

Creates a new service. You will be prompted for the type (if not passed as parameter) and name of the service.

af delete-service [servicename]

Removes a service. If you do not provide a service name, you will be presented with a list of all of your services.

af bind-service [servicename] [appname]

Associates a service with an application.

af unbind-service [servicename] [appname]

Removes the association of a service with an application.

af clone-services [sourceapp] [destingationapp]

Clones all the services from one app to another one.

af tunnel

Creates a tunnel to a remote service. For example, this is useful to query your remote databases. Using this command requires the caldecott gem.

Often it will be easier to create services from the AppFog web console. However, it is possible to do it from the command line as well. In this example, we will create a new MySQL database service and associate it with an existing application. It is important to note that when deleting a service with the command line, you will not be prompted to confirm the deletion, so be sure you use the correct command:

$ af create-service mysql insideaf4-db
1: AWS US East - Virginia
2: AWS EU West - Ireland
3: AWS Asia SE - Singapore
4: HP AZ 2 - Las Vegas
Select Infrastructure: 1
Creating Service: OK

$ af bind-service insideaf4-db insideaf4
Binding Service [insideaf4-db]: OK
Stopping Application 'insideaf4': OK
Staging Application 'insideaf4': OK
Starting Application 'insideaf4': OK

$ af services

============== System Services ==============

+------------+---------+-------------------------------+
| Service    | Version | Description                   |
+------------+---------+-------------------------------+
| mongodb    | 1.8     | MongoDB NoSQL store           |
| mysql      | 5.1     | MySQL database service        |
| postgresql | 9.1     | PostgreSQL database service   |
| rabbitmq   | 2.4     | RabbitMQ message queue        |
| redis      | 2.2     | Redis key-value store service |
+------------+---------+-------------------------------+

=========== Provisioned Services ============

+--------------+---------+-----+
| Name         | Service | In  |
+--------------+---------+-----+
| insideaf4-db | mysql   | aws |
+--------------+---------+-----+

$ af apps

+-------------+--------------+
| Application | Services     |
+-------------+--------------+
| insideaf4   | insideaf4-db |
+-------------+--------------+

$ af unbind-service insideaf4-db insideaf4
Unbinding Service [insideaf4-db]: OK
Stopping Application 'insideaf4': OK
Staging Application 'insideaf4': OK
Starting Application 'insideaf4': OK

$ af delete-service insideaf4-db
Deleting service [insideaf4-db]: OK
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.217.199.122