github.com/misfo/deis@v1.0.1-0.20141111224634-e0eee0392b8a/docs/installing_deis/aws.rst (about)

     1  :title: Installing Deis on AWS
     2  :description: How to provision a multi-node Deis cluster on Amazon AWS
     3  
     4  .. _deis_on_aws:
     5  
     6  Amazon AWS
     7  ==========
     8  
     9  In this tutorial, we will show you how to set up your own 3-node cluster on Amazon Web Services.
    10  
    11  Please refer to the scripts in `contrib/ec2`_ while following this documentation.
    12  
    13  
    14  Install the AWS Command Line Interface
    15  --------------------------------------
    16  
    17  In order to start working with Amazon's API, let's install `awscli`_:
    18  
    19  .. code-block:: console
    20  
    21      $ pip install awscli
    22      Downloading/unpacking awscli
    23        Downloading awscli-1.5.0.tar.gz (248kB): 248kB downloaded
    24      ...
    25      Successfully installed awscli
    26  
    27  
    28  Configure aws-cli
    29  -----------------
    30  
    31  Run ``aws configure`` to set your AWS credentials:
    32  
    33  
    34  .. code-block:: console
    35  
    36      $ aws configure
    37      AWS Access Key ID [None]: ***************
    38      AWS Secret Access Key [None]: ************************
    39      Default region name [None]: us-west-1
    40      Default output format [None]:
    41  
    42  
    43  Upload keys
    44  -----------
    45  
    46  Generate and upload a new keypair to AWS, ensuring that the name of the keypair is set to "deis".
    47  
    48  .. code-block:: console
    49  
    50      $ ssh-keygen -q -t rsa -f ~/.ssh/deis -N '' -C deis
    51      $ aws ec2 import-key-pair --key-name deis --public-key-material file://~/.ssh/deis.pub
    52  
    53  
    54  Choose Number of Instances
    55  --------------------------
    56  
    57  By default, the script will provision 3 servers. You can override this by setting
    58  ``DEIS_NUM_INSTANCES``:
    59  
    60  .. code-block:: console
    61  
    62      $ export DEIS_NUM_INSTANCES=5
    63  
    64  Note that for scheduling to work properly, clusters must consist of at least 3 nodes and always
    65  have an odd number of members. For more information, see `optimal etcd cluster size`_.
    66  
    67  Deis clusters of less than 3 nodes are unsupported.
    68  
    69  
    70  Generate a New Discovery URL
    71  ----------------------------
    72  
    73  To get started with provisioning Deis, we will need to generate a new Discovery URL. Discovery URLs
    74  help connect `etcd`_ instances together by storing a list of peer addresses and metadata under a
    75  unique address. You can generate a new discovery URL for use in your platform by
    76  running the following from the root of the repository:
    77  
    78  .. code-block:: console
    79  
    80      $ make discovery-url
    81  
    82  This will write a new discovery URL to the user-data file. Some convenience scripts are supplied in
    83  this user-data file, so it is mandatory for provisioning Deis.
    84  
    85  
    86  Customize cloudformation.json
    87  -----------------------------
    88  
    89  Any of the parameter defaults defined in deis.template.json can be overridden by setting the value
    90  in `cloudformation.json`_ like so:
    91  
    92  .. code-block:: console
    93  
    94      {
    95          "ParameterKey":     "InstanceType",
    96          "ParameterValue":   "m3.xlarge"
    97      },
    98      {
    99          "ParameterKey":     "KeyPair",
   100          "ParameterValue":   "jsmith"
   101      },
   102      {
   103          "ParameterKey":     "EC2VirtualizationType",
   104          "ParameterValue":   "PV"
   105      },
   106      {
   107          "ParameterKey":     "AssociatePublicIP",
   108          "ParameterValue":   "false"
   109      }
   110  
   111  The only entry in cloudformation.json required to launch your cluster is `KeyPair`, which is
   112  already filled out. The defaults will be applied for the other settings.
   113  
   114  If updated with update-ec2-cluster.sh, the InstanceType will only impact newly deployed instances
   115  (`#1758`_).
   116  
   117  NOTE: The smallest recommended instance size is `large`. Having not enough CPU or RAM will result
   118  in numerous issues when using the cluster.
   119  
   120  
   121  Launch into an existing VPC
   122  ---------------------------
   123  
   124  By default, the provided CloudFormation script will create a new VPC for Deis. However, the script
   125  supports provisioning into an existing VPC instead. You'll need to have a VPC configured with an
   126  internet gateway and a sane routing table (the default VPC in a region should be ready to go).
   127  
   128  To launch your cluster into an existing VPC, export three additional environment variables:
   129  
   130   - ``VPC_ID``
   131   - ``VPC_SUBNETS``
   132   - ``VPC_ZONES``
   133  
   134  ``VPC_ZONES`` must list the availability zones of the subnets in order.
   135  
   136  For example, if your VPC has ID ``vpc-a26218bf`` and consists of the subnets ``subnet-04d7f942``
   137  (which is in ``us-east-1b``) and ``subnet-2b03ab7f`` (which is in ``us-east-1c``) you would export:
   138  
   139  .. code-block:: console
   140  
   141      export VPC_ID=vpc-a26218bf
   142      export VPC_SUBNETS=subnet-04d7f942,subnet-2b03ab7f
   143      export VPC_ZONES=us-east-1b,us-east-1c
   144  
   145  
   146  Run the Provision Script
   147  ------------------------
   148  
   149  Run the cloudformation provision script to spawn a new CoreOS cluster:
   150  
   151  .. code-block:: console
   152  
   153      $ cd contrib/ec2
   154      $ ./provision-ec2-cluster.sh
   155      {
   156          "StackId": "arn:aws:cloudformation:us-west-1:413516094235:stack/deis/9699ec20-c257-11e3-99eb-50fa01cd4496"
   157      }
   158      Your Deis cluster has successfully deployed.
   159      Please wait for all instances to come up as "running" before continuing.
   160  
   161  Check the AWS EC2 web control panel and wait until "Status Checks" for all instances have passed.
   162  This will take several minutes.
   163  
   164  
   165  Configure DNS
   166  -------------
   167  
   168  See :ref:`configure-dns` for more information on properly setting up your DNS records with Deis.
   169  
   170  
   171  Install Deis Platform
   172  ---------------------
   173  
   174  Now that you've finished provisioning a cluster, please refer to :ref:`install_deis_platform` to
   175  start installing the platform.
   176  
   177  
   178  .. _`#1758`: https://github.com/deis/deis/issues/1758
   179  .. _`awscli`: https://github.com/aws/aws-cli
   180  .. _`contrib/ec2`: https://github.com/deis/deis/tree/master/contrib/ec2
   181  .. _`cloudformation.json`: https://github.com/deis/deis/blob/master/contrib/ec2/cloudformation.json
   182  .. _`etcd`: https://github.com/coreos/etcd
   183  .. _`optimal etcd cluster size`: https://github.com/coreos/etcd/blob/master/Documentation/optimal-cluster-size.md