@@ -7,10 +7,12 @@ AWS Web Stacks
7
7
AWS Web Stacks is a library of CloudFormation templates that dramatically simplify hosting web applications
8
8
on AWS. The library supports using Elastic Container Service (ECS), Elastic Beanstalk (EB), EC2 instances
9
9
(via an AMI you specify), or `Dokku <http://dokku.viewdocs.io/dokku/ >`_ for the application server(s) and
10
- provides auxilary managed services such as a Postgres RDS instance, Redis instance, Elasticsearch instance
10
+ provides auxilary managed services such as an RDS instance, ElastiCache instance, Elasticsearch instance
11
11
(free) SSL certificate via AWS Certificate Manager, S3 bucket for static assets, ECS repository for hosting
12
- Docker images, etc. All resources (except Elasticsearch, which does not support VPCs) are created in a
13
- self-contained VPC, which may use a NAT gateway (if you want to pay for that) or not.
12
+ Docker images, etc. All resources (that support VPCs) are created in a self-contained VPC, which may use a
13
+ NAT gateway (if you want to pay for that) or not, and resources that require API authentication (such as
14
+ S3 or Elasticsearch) are granted permissions via the IAM instance role and profile assigned to the
15
+ application servers created in the stack.
14
16
15
17
The CloudFormation templates are written in `troposphere <https://github.com/cloudtools/troposphere >`_,
16
18
which allows for some validation at build time and simplifies the management of several related
@@ -67,6 +69,12 @@ wish to use the JSON template directly:
67
69
.. _Dokku-No-NAT : https://console.aws.amazon.com/cloudformation/home?#/stacks/new?stackName=dokku-no-nat&templateURL=https://s3.amazonaws.com/aws-web-stacks/dokku-no-nat.json
68
70
.. _dokku-no-nat.json : https://s3.amazonaws.com/aws-web-stacks/dokku-no-nat.json
69
71
72
+ Documentation
73
+ -------------
74
+
75
+ In addition to this README, there is additional documentation at
76
+ http://aws-web-stacks.readthedocs.io/
77
+
70
78
71
79
Elastic Beanstalk, Elastic Container Service, EC2, or Dokku?
72
80
------------------------------------------------------------
@@ -90,8 +98,8 @@ it appear unhealthy, e.g.::
90
98
91
99
For very simple, Heroku-like deploys, choose the **Dokku ** option. This will give you a single EC2 instance
92
100
based on Ubuntu 16.04 LTS with `Dokku <http://dokku.viewdocs.io/dokku/ >`_ pre-installed and global environment
93
- variables configured that will allow your app to find the Postgres, Redis or Memcached , and Elasticsearch nodes
94
- created with this stack.
101
+ variables configured that will allow your app to find the RDS, ElastiCache , and Elasticsearch nodes created
102
+ with this stack.
95
103
96
104
NAT Gateways
97
105
------------
@@ -140,8 +148,10 @@ The following is a partial list of resources created by this stack, when Elastic
140
148
which will be pre-configured with the environment variables specified below.
141
149
* **Elasticsearch ** (``AWS::Elasticsearch::Domain ``): An Elasticsearch instance, which your
142
150
application may use for full-text search, logging, etc.
143
- * **PostgreSQL ** (``AWS::RDS::DBInstance ``): The Postgres RDS instance for your application.
144
- Includes a security group to allow access only from your EB or ECS instances in this stack.
151
+ * **PostgreSQL ** (``AWS::RDS::DBInstance ``): The RDS instance for your application.
152
+ Includes a security group to allow access only from your EB or ECS instances in this stack. Note:
153
+ this CloudFormation resource is named "PostgreSQL" for backwards-compatibility reasons, but the
154
+ RDS instance can be configured with any database engine supported by RDS.
145
155
* **Redis ** (``AWS::ElastiCache::CacheCluster ``): The Redis ElasticCache instance for your
146
156
application. Includes a cache security group to allow access only from your EB or ECS instances in
147
157
this stack.
@@ -183,8 +193,8 @@ application on the specified port, with all of the necessary secrets and environ
183
193
Note that the Elastic Load Balancer will not direct traffic to your instances until the health
184
194
check you specify during stack creation returns a successful response.
185
195
186
- Environment Variables
187
- ---------------------
196
+ Environment Variables within your server instances
197
+ --------------------------------------------------
188
198
189
199
Once your environment is created you'll have an Elastic Beanstalk (EB) or Elastic Compute Service
190
200
(ECS) environment with the environment variables you need to run a containerized web application.
@@ -380,11 +390,57 @@ job to automatically renew the cert as needed::
380
390
381
391
The Python sample app should now be accessible over HTTPS at https://python-sample.your.domain/
382
392
393
+ Creating or updating templates
394
+ ------------------------------
395
+
396
+ Templates built from the latest release of aws-web-stacks will be available in
397
+ S3 (see links near the top of this file). They're built with generic defaults.
398
+
399
+ Templates are built by setting some environment variables with your preferences
400
+ and then running ``python -c 'import stack' `` (see the Makefile).
401
+ The template file is output to standard output. It's easy to do this on one line::
402
+
403
+ USE_EC2=on python -c 'import stack' >my_ec2_stack_template.json
404
+
405
+ Here are the environment variables that control the template creation.
406
+
407
+ USE_EC2=on
408
+ Create EC2 instances directly.
409
+ USE_GOVCLOUD=on
410
+ Create EC2 instances directly, but disables AWS services that aren't available
411
+ in GovCloud like the AWS Certificate Manager and Elastic Search.
412
+ USE_EB=on
413
+ Create an Elastic Beanstalk application
414
+ USE_ECS=on
415
+ Create an Elastic Container Service.
416
+ USE_DOKKU=on
417
+ Create an EC2 instance containing a Dokku server
418
+
419
+ I believe those environment variables are mutually exclusive. The remaining
420
+ ones can be used in combination with each other or one of the above.
421
+
422
+ USE_NAT_GATEWAY=on
423
+ Don't put the services inside your VPC onto the public internet, and
424
+ add a NAT gateway to the stack to the services can make connections out.
425
+ DEFAULTS_FILE=<path to JSON file>
426
+ Changes the default values for parameters. The JSON file should just be
427
+ a dictionary mapping parameter names to default values, e.g.::
428
+
429
+ {
430
+ "AMI": "ami-078c57a94e9bdc6e0",
431
+ "AssetsUseCloudFront": "false"
432
+ }
433
+
434
+ One more example, creating EC2 instances without a NAT gateway and overriding
435
+ the parameter defaults::
436
+
437
+ USE_EC2=on DEFAULTS_FILE=stack_defaults.json python -c 'import stack' >stack.json
438
+
383
439
Contributing
384
440
------------
385
441
386
442
Please read `contributing guidelines here <https://github.com/caktus/aws-web-stacks/blob/develop/CONTRIBUTING.rst >`_.
387
443
388
444
Good luck and have fun!
389
445
390
- Copyright 2017 Jean-Phillipe Serafin, Tobias McNulty.
446
+ Copyright 2017, 2018 Jean-Phillipe Serafin, Tobias McNulty.
0 commit comments