| 1 |
Cloud |
| 2 |
===== |
| 3 |
|
| 4 |
There are a variety of ways to deploy Dask on the cloud. |
| 5 |
Cloud providers offer managed services, |
| 6 |
like VMs, Kubernetes, Yarn, or custom APIs with which Dask can connect easily. |
| 7 |
|
| 8 |
.. grid:: 1 1 2 2 |
| 9 |
|
| 10 |
.. grid-item:: |
| 11 |
:columns: 7 |
| 12 |
|
| 13 |
Some common deployment options you may want to consider are: |
| 14 |
|
| 15 |
- A commercial Dask deployment option like `Coiled <https://coiled.io?utm_source=dask-docs&utm_medium=deploying-cloud>`_ |
| 16 |
to handle the creation and management of Dask clusters on AWS, GCP, and Azure. |
| 17 |
- A managed Kubernetes service and Dask's |
| 18 |
:doc:`Kubernetes integration <deploying-kubernetes>`. |
| 19 |
- Directly launching cloud resources such as VMs or containers via a cluster manager with |
| 20 |
`Dask Cloud Provider <https://cloudprovider.dask.org/en/latest/>`_. |
| 21 |
- A managed Yarn service, |
| 22 |
like `Amazon EMR <https://aws.amazon.com/emr/>`_ |
| 23 |
or `Google Cloud DataProc <https://cloud.google.com/dataproc/>`_ |
| 24 |
and `Dask-Yarn <https://yarn.dask.org>`_ |
| 25 |
(specific documentation for the popular Amazon EMR service can be found |
| 26 |
`here <https://yarn.dask.org/en/latest/aws-emr.html>`_.) |
| 27 |
|
| 28 |
|
| 29 |
.. grid-item:: |
| 30 |
:columns: 5 |
| 31 |
:child-align: center |
| 32 |
|
| 33 |
.. figure:: images/cloud-provider-logos.svg |
| 34 |
|
| 35 |
Cloud Deployment Examples |
| 36 |
------------------------- |
| 37 |
|
| 38 |
.. tab-set:: |
| 39 |
|
| 40 |
.. tab-item:: Coiled |
| 41 |
|
| 42 |
`Coiled <https://coiled.io?utm_source=dask-docs&utm_medium=deploying-cloud>`_ |
| 43 |
deploys managed Dask clusters on AWS, GCP, and Azure. It's free for most users and |
| 44 |
has several features that address common |
| 45 |
:doc:`deployment pain points <deployment-considerations>` like: |
| 46 |
|
| 47 |
- Easy to use API |
| 48 |
- Automatic software synchronization |
| 49 |
- Easy access to any cloud hardware (like GPUs) in any region |
| 50 |
- Robust logging, cost controls, and metrics collection |
| 51 |
|
| 52 |
.. code-block:: python |
| 53 |
|
| 54 |
>>> import coiled |
| 55 |
>>> cluster = coiled.Cluster( |
| 56 |
... n_workers=100, # Size of cluster |
| 57 |
... region="us-west-2", # Same region as data |
| 58 |
... vm_type="m6i.xlarge", # Hardware of your choosing |
| 59 |
... ) |
| 60 |
>>> client = cluster.get_client() |
| 61 |
|
| 62 |
Coiled is recommended for deploying Dask on the cloud. |
| 63 |
Though there are non-commercial, open source options like |
| 64 |
Dask Cloud Provider, Dask-Gateway, and Dask-Yarn that are also available |
| 65 |
(see :ref:`cloud deployment options <cloud-deployment-options>` |
| 66 |
for additional options.) |
| 67 |
|
| 68 |
|
| 69 |
.. tab-item:: Dask Cloud Provider |
| 70 |
|
| 71 |
Using `Dask Cloud Provider <https://cloudprovider.dask.org/en/latest/>`_ to launch a cluster of |
| 72 |
VMs on a platform like `DigitalOcean <https://www.digitalocean.com/>`_ can be as convenient as |
| 73 |
launching a local cluster. |
| 74 |
|
| 75 |
.. code-block:: python |
| 76 |
|
| 77 |
>>> import dask.config |
| 78 |
>>> dask.config.set({"cloudprovider.digitalocean.token": "yourAPItoken"}) |
| 79 |
>>> from dask_cloudprovider.digitalocean import DropletCluster |
| 80 |
>>> cluster = DropletCluster(n_workers=1) |
| 81 |
Creating scheduler instance |
| 82 |
Created droplet dask-38b817c1-scheduler |
| 83 |
Waiting for scheduler to run |
| 84 |
Scheduler is running |
| 85 |
Creating worker instance |
| 86 |
Created droplet dask-38b817c1-worker-dc95260d |
| 87 |
|
| 88 |
Many of the cluster managers in Dask Cloud Provider work by launching VMs with a startup script |
| 89 |
that pulls down the :doc:`Dask Docker image <deploying-docker>` and runs Dask components within that container. |
| 90 |
As with all cluster managers the VM resources, Docker image, etc are all configurable. |
| 91 |
|
| 92 |
You can then connect a client and work with the cluster as if it were on your local machine. |
| 93 |
|
| 94 |
.. code-block:: python |
| 95 |
|
| 96 |
>>> client = cluster.get_client() |
| 97 |
|
| 98 |
Data Access |
| 99 |
----------- |
| 100 |
|
| 101 |
In addition to deploying Dask clusters on the cloud, most cloud users will also want |
| 102 |
to access cloud-hosted data on their respective cloud provider. |
| 103 |
|
| 104 |
We recommend installing additional libraries (listed below) for easy data access on your cloud provider. |
| 105 |
See :doc:`how-to/connect-to-remote-data` for more information. |
| 106 |
|
| 107 |
.. tab-set:: |
| 108 |
|
| 109 |
.. tab-item:: AWS |
| 110 |
|
| 111 |
Use `s3fs <https://s3fs.readthedocs.io/>`_ for accessing data on Amazon's S3. |
| 112 |
|
| 113 |
.. code-block:: bash |
| 114 |
|
| 115 |
pip install s3fs |
| 116 |
|
| 117 |
.. tab-item:: GCP |
| 118 |
|
| 119 |
Use `gcsfs <https://gcsfs.readthedocs.io/>`_ for accessing data on Google's GCS. |
| 120 |
|
| 121 |
.. code-block:: bash |
| 122 |
|
| 123 |
pip install gcsfs |
| 124 |
|
| 125 |
.. tab-item:: Azure |
| 126 |
|
| 127 |
Use `adlfs <https://github.com/dask/adlfs/>`_ for accessing data on Microsoft's Data Lake or Blob Storage. |
| 128 |
|
| 129 |
.. code-block:: bash |
| 130 |
|
| 131 |
pip install adlfs |