|
| 1 | +# Deploy |
| 2 | + |
| 3 | +## Prerequisites |
| 4 | + |
| 5 | +### AWS ClI |
| 6 | + |
| 7 | +1. In AWS Console, go to IAM. |
| 8 | +2. Go to User section, click on "Add users". Give it a name, recommend "<you_name>\_cli". Ciick "Next". |
| 9 | +3. Add the user to a User Group that has AdministratorAccess policy. |
| 10 | +4. After user is created, open the user page in IAM, go to "Security credentials" tab, in "Access keys" section, click "Create access key". |
| 11 | +5. Select "Command Line Interface (CLI)", and ignore the warning. Click "Next". |
| 12 | +6. **Don't navigate away from the web page that shows key ID and secret**, because this is the last time you will have access to the key's secret. After key is created, configure AWS CLI. |
| 13 | + |
| 14 | + ```sh |
| 15 | + aws configure |
| 16 | + ``` |
| 17 | + |
| 18 | + Then enter Access Key ID and Secret Access Key. |
| 19 | + |
| 20 | + You can also configure a new profile: |
| 21 | + |
| 22 | + ```sh |
| 23 | + aws configure --profile <profile_name> |
| 24 | + ``` |
| 25 | + |
| 26 | + When running other aws commands, just add `--profile <profile_name>` to each command. |
| 27 | + |
| 28 | +## Deploy |
| 29 | + |
| 30 | +### Shared Resources |
| 31 | + |
| 32 | +This section describes development of shared resources across stacks. |
| 33 | + |
| 34 | +1. (**Not required for every deployment**) Create ACM Certificates: |
| 35 | + |
| 36 | + This CloudFormation stack is created specifically for creating ACM certificates in us-east-1. Because according to AWS documentation, CloudFront can only use certificates in us-east-1. |
| 37 | + |
| 38 | + ```sh |
| 39 | + aws --region us-east-1 \ |
| 40 | + cloudformation deploy \ |
| 41 | + --template-file deploy/cloudformation-acm-certificates.yaml \ |
| 42 | + --stack-name DaiweiLuCerts |
| 43 | + ``` |
| 44 | + |
| 45 | + (Optional) You can use this command to conveniently query for the outputs of the stack. |
| 46 | + |
| 47 | + ```sh |
| 48 | + aws --region us-east-1 \ |
| 49 | + cloudformation describe-stacks \ |
| 50 | + --stack-name DaiweiLuCerts | jq ".Stacks[0].Outputs" |
| 51 | + ``` |
| 52 | + |
| 53 | + - `--region`: Specify AWS region for resources to be created in. |
| 54 | + - `--profile`: (Optional) Specifies the profile used for authentication. (See [Prerequisites](#prerequisites) section above for details on profile creation.) |
| 55 | + - `--template-file`: The CloudFormation template that AWS resources will be created from. |
| 56 | + - `--stack-name`: The name of the CloudFormation Stack. |
| 57 | + - `--capabilities`: Allow the template to create IAM resources. |
0 commit comments