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