Skip to content

Commit 8995119

Browse files
committed
Add CloudFormation for generating ACM cert
1 parent 4b47ef8 commit 8995119

File tree

3 files changed

+75
-1
lines changed

3 files changed

+75
-1
lines changed

deploy/README.md

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
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.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
AWSTemplateFormatVersion: 2010-09-09
2+
Description: >
3+
This template is for creating ACM Certificates in us-east-1 region.
4+
Resources:
5+
# --- ACM ---
6+
AcmCertificateFrontendDomain:
7+
Type: AWS::CertificateManager::Certificate
8+
Properties:
9+
DomainName: "*.daiwei.lu"
10+
DomainValidationOptions:
11+
- DomainName: "*.daiwei.lu"
12+
# The HostedZone is managed manually to prevent errors in automation
13+
HostedZoneId: Z0918167TAPNANZ73C9D
14+
ValidationMethod: DNS
15+
Outputs:
16+
AcmCertificateFrontendDomainArn:
17+
Value: !Ref AcmCertificateFrontendDomain

package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)