setup.rst 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. Setup
  2. -----
  3. To initialize a connection to a cloud and get a provider object, you will
  4. need to provide the cloud's access credentials to CloudBridge. These may
  5. be provided in one of two ways:
  6. 1. Environment variables
  7. 2. A dictionary
  8. Providing access credentials through environment variables
  9. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  10. The following environment variables must be set, depending on the provider in use.
  11. **Amazon**
  12. =================== ==================
  13. Mandatory variables Optional Variables
  14. =================== ==================
  15. AWS_ACCESS_KEY
  16. AWS_SECRET_KEY
  17. =================== ==================
  18. **Openstack**
  19. =================== ==================
  20. Mandatory variables Optional Variables
  21. =================== ==================
  22. OS_AUTH_URL NOVA_SERVICE_NAME
  23. OS_USERNAME OS_COMPUTE_API_VERSION
  24. OS_PASSWORD OS_VOLUME_API_VERSION
  25. OS_TENANT_NAME
  26. OS_REGION_NAME
  27. =================== ==================
  28. If you'd like, you can specify service-specific variables for OpenStack.
  29. This can be used to create a multi-cloud provider object for example where
  30. the compute service is using one cloud while the object store service uses
  31. another. This can be useful is a given cloud does not supply all the desired
  32. services. If these variables are not supplied, the default ones from above
  33. are used across all OpenStack services.
  34. =================================== ==============
  35. Optional service-specific variables Example values
  36. ----------------------------------- --------------
  37. Swift service
  38. ==================================================
  39. OS_SWIFT_AUTH_URL https://keystone.rc.nectar.org.au:5000/v2.0/
  40. OS_SWIFT_USERNAME your.name@example.com
  41. OS_SWIFT_PASSWORD GcsGgcbsdilcbUIYGcsdc
  42. OS_SWIFT_REGION_NAME RegionOne
  43. OS_SWIFT_TENANT_NAME GalaxyProject
  44. =================================== ==============
  45. Once the environment variables are set, you can create a connection as follows:
  46. .. code-block:: python
  47. from cloudbridge.cloud.factory import CloudProviderFactory, ProviderList
  48. provider = CloudProviderFactory().create_provider(ProviderList.OPENSTACK, {})
  49. Providing access credentials through a dictionary
  50. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  51. You can initialize a simple config as follows. The key names are the same
  52. as the environment variables, in lower case. Note that the config dictionary
  53. will override environment values.
  54. .. code-block:: python
  55. from cloudbridge.cloud.factory import CloudProviderFactory, ProviderList
  56. config = {'aws_access_key' : '<your_access_key>',
  57. 'aws_secret_key' : '<your_secret_key>'}
  58. provider = CloudProviderFactory().create_provider(ProviderList.AWS, config)
  59. Some optional configuration values can only be provided through the config
  60. dictionary. These are listed below for each provider.
  61. **CloudBridge**
  62. ==================== ==================
  63. Variable Description
  64. ==================== ==================
  65. default_result_limit Number of results that a ``.list()`` method should return.
  66. Defaults to 50.
  67. ==================== ==================
  68. **Amazon**
  69. ==================== ==================
  70. Variable Description
  71. ==================== ==================
  72. ec2_is_secure True to use an SSL connection. Default is ``True``.
  73. ec2_region_name Default region name. Defaults to ``us-east-1``.
  74. ec2_region_endpoint Endpoint to use. Default is ``ec2.us-east-1.amazonaws.com``.
  75. ec2_port EC2 connection port. Does not need to be specified unless
  76. EC2 service is running on an alternative port.
  77. ec2_conn_path Connection path. Defaults to ``/``.
  78. ec2_validate_certs Whether to use SSL certificate verification. Default is
  79. ``False``.
  80. s3_is_secure True to use an SSL connection. Default is ``True``.
  81. s3_host Host connection endpoint. Default is ``s3.amazonaws.com``.
  82. s3_port Host connection port. Does not need to be specified unless
  83. S3 service is running on an alternative port.
  84. s3_conn_path Connection path. Defaults to ``/``.
  85. s3_validate_certs Whether to use SSL certificate verification. Default is
  86. ``False``.
  87. ==================== ==================
  88. Other configuration variables
  89. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  90. In addition to the provider specific configuration variables above, there are
  91. some general configuration environment variables that apply to CloudBridge as
  92. a whole
  93. ===================== ==================
  94. Variable Description
  95. ===================== ==================
  96. CB_DEBUG Setting ``CB_DEBUG=True`` will cause detailed debug
  97. output to be printed for each provider (including HTTP
  98. traces).
  99. CB_USE_MOCK_PROVIDERS Setting this to ``True`` will cause the CloudBridge test
  100. suite to use mock drivers when available.
  101. CB_TEST_PROVIDER Set this value to a valid :class:`.ProviderList` value
  102. such as ``aws``, to limit tests to that provider only.
  103. ===================== ==================