1 | # 🥔 Potato
|
2 |
|
3 | The purpose of the Potato CLI tool is to streamline the process when you want to host a static web page on S3 and deliver it using CloudFront.
|
4 |
|
5 | <div align="center">
|
6 | <img src="https://raw.githubusercontent.com/0x4447/0x4447-cli-potato/master/assets/main.png">
|
7 | </div>
|
8 |
|
9 | # How to Install
|
10 |
|
11 | ```
|
12 | sudo npm install -g @0x4447/potato
|
13 | ```
|
14 |
|
15 | # Usage
|
16 |
|
17 | ```
|
18 | potato -s PATH_TO_FOLDER
|
19 | ```
|
20 |
|
21 | # IAM Programmatic Credentials
|
22 |
|
23 | To use this CLI, create a programmatic user with the following permissions:
|
24 |
|
25 | - AmazonS3FullAccess
|
26 | - CloudFrontFullAccess
|
27 | - AmazonRoute53FullAccess
|
28 | - AWSCertificateManagerFullAccess
|
29 |
|
30 | # What Potato Does
|
31 |
|
32 | With this CLI, you have the following options:
|
33 |
|
34 | ### Update
|
35 |
|
36 | This option allows you to update the content of a site on S3 and automatically invalidate the CloudFront Distribution Cache. Just provide the path to the folder that contains the new content, and the CLI will automatically do the rest for you. All you have to do is follow the steps on the screen.
|
37 |
|
38 | ### Create
|
39 |
|
40 | This process is more involved, but it will save your sanity, as well as quite a bit of time. When you select this option, you'll be asked for the domain name you'd like to use for your website. When you supply that information, everything else is automatic, so all you need to do is sit down and relax. The following is a list of all of the things that will happen in the background:
|
41 |
|
42 | - list_all_certificates
|
43 | - look_for_domain_certificate
|
44 | - create_a_certificate
|
45 | - get_certificate_metadata
|
46 | - list_hosted_zones
|
47 | - look_for_domain
|
48 | - update_route53_with_cert_validation
|
49 | - check_certificate_validity
|
50 | - check_if_bucket_exists
|
51 | - create_a_bucket
|
52 | - convert_bucket_to_site
|
53 | - change_bucket_policy
|
54 | - upload
|
55 | - create_a_distribution
|
56 | - get_all_domain_records
|
57 | - look_for_domain_entry
|
58 | - delete_domain_entry
|
59 | - create_a_route_53_record
|
60 | - print_domain_configuration
|
61 |
|
62 | **WARNING**: What if the certificate takes too long to validate? After 30 seconds, the app will quit and print out a detailed explanation of what your next steps are. Take the time to thoroughly go over the printout, and you'll be good.
|
63 |
|
64 | # Is Deployment Instant?
|
65 |
|
66 | No, it's not. The following aspects don't happen right away:
|
67 |
|
68 | - SSL Certificate confirmation
|
69 | - CloudFront distribution
|
70 |
|
71 | ### SSL Certificate Confirmation
|
72 |
|
73 | The time frame for this process ranges from 10 seconds to 24 hours. It's completely unpredictable, and there's no way to speed up the process. Because of this, the app will quit if the certificate isn't confirmed within 30 seconds. When that happens, go to the AWS Console to monitor the certificate.
|
74 |
|
75 | ### CloudFront Distribution
|
76 |
|
77 | This takes up to 15 or 20 minutes, but when you reach this point, you can be certain that the configuration is correct. At this point, you just need to wait until the process is complete. Only then will the domain deliver the website.
|
78 |
|
79 | # Why This Name?
|
80 |
|
81 | Why not? We had to call it something. And once you see it, you're not going to forget it. 😃
|
82 |
|
83 | # The End
|
84 |
|
85 | If you enjoyed this article/project, please consider giving it a 🌟. And check out our [0x4447 GitHub account](https://github.com/0x4447), where we have additional articles and tools that you might find interesting.
|
86 |
|
87 | # For Hire 👨💻 👩💻
|
88 |
|
89 | If you'd like us to help you with something, please feel free to say hello@0x4447.com, and share what's on your mind. We'll take a look, and try our best to help you. Or visit our website at: [0x4447.com](https://0x4447.com).
|