|
| 1 | +# Deploying to AWS |
| 2 | + |
| 3 | + |
| 4 | +## Requirements: |
| 5 | + |
| 6 | +### [mapbox/cfn-config](https://github.com/mapbox/cfn-config) |
| 7 | + |
| 8 | +Follow the prerequisites for installation for the cfn-config tool, then install using npm. |
| 9 | + |
| 10 | +``` |
| 11 | +npm install -g @mapbox/cfn-config |
| 12 | +``` |
| 13 | + |
| 14 | +**Other Requirements** |
| 15 | +- AWS permissions to access S3 buckets, cloudformation templates, and route53 records |
| 16 | +- AWS Domain and SSL certificate on ACM |
| 17 | + |
| 18 | +### OMK Config bucket |
| 19 | + |
| 20 | +Create an S3 bucket to hold the form data (in this doc we will use `s3://OpenMapKitServer-storage`), and a folder in that bucket called `settings/`. |
| 21 | + |
| 22 | +## Deploying OMK |
| 23 | + |
| 24 | +`cfn-config` creates a CloudFormation template and manages the deployment to AWS resources. Be sure to give a relevant name to this deployment (aka application stack). We will use `example`. Before deploying, configure the `cloudformation/users.json` file as needed and upload to `s3://OpenMapKitServer-storage/settings/OpenMapKitServer-example/`. Then run the `cfn-config command`: |
| 25 | + |
| 26 | +``` |
| 27 | +cfn-config create example cloudformation/OpenMapKitServer.template.js -t <cfn-config-bucket> -c <cfn-config-bucket> |
| 28 | +``` |
| 29 | + |
| 30 | +`<cfn-config-bucket>` is the bucket created while installing cfn-config. The tool will prompt the following parameters: |
| 31 | + |
| 32 | +``` |
| 33 | +? Saved configurations New configuration |
| 34 | +? GitSha. Repository GitSha: <The Git hash of the most recent version of OMK Server> |
| 35 | +? ELBSubnets. ELB subnets: <A comma-separated string of subnets the EC2 can run on> |
| 36 | +? S3Bucket. S3 bucket: OpenMapKitServer-storage |
| 37 | +? S3Prefix. S3 prefix for the bucket: example |
| 38 | +? OpenMapKitVersion. OpenMapKit Version, to download and extract the frontend: v1.5.1 |
| 39 | +? EnableS3Sync. Enable S3 sync: true |
| 40 | +? EnableHTTPS. Enable HTTPS (required to setup the form submission endpoint): true |
| 41 | +? NodeEnvironment. NODE_ENV environment variable: production |
| 42 | +? SSLCertificateIdentifier. SSL certificate for HTTPS protocol: <ACM Certificate ID> |
| 43 | +? UsersS3Bucket. Bucket with login details. Logins are stored at S3://<UsersS3Bucket>/settings/<OMK_stack_name>/users.json: OpenMapKitServer-storage |
| 44 | +? Ready to create the stack? (Y/n) |
| 45 | +``` |
| 46 | + |
| 47 | +When the process is finished, the IP address to access OMK will be found in the EC2 Application Load Balancer console. |
0 commit comments