Cloud Resume Challenge
Published: 2024-01-23 11:53:11

## Quest
Ready to embark on an exciting adventure known as the Cloud Resume Challenge. With determination in their heart and a keyboard in hand, they delved into the digital realm, ready to conquer the challenges that awaited them in the vast and mysterious land of the cloud. So, with each keystroke, they forged their path in the captivating story of taking on the Cloud Resume Challenge.

---

## MGM's Cloud Resume Challenge
This highlights my [Cloud Resume Challenge](https://cloudresumechallenge.dev/docs/the-challenge/aws/), built on AWS. The [website](https://miguel.nothingcreatessomething.com/) is hosted on AWS S3 Storage, incorporating a visitor counter and utilizing Amazon Simple Email Service through AWS Functions. The development encompasses HTML, CSS, and JavaScript, with the visitor counter driven by Terraform in collaboration with AWS Lambda Functions.


![Architecture](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x8ukh1xccggz4x3r8bc1.png)



1. **File Upload to Amazon S3:**
   Transfer your HTML, CSS, and JavaScript files to an Amazon S3 bucket, establishing a secure foundation for hosting your web content.

2. **Securing S3 Website with HTTPS:**
   Strengthen the security of your S3 website URL by implementing HTTPS. Utilize Amazon CloudFront to enhance support and establish a robust, encrypted communication channel.

3. **SSL/TLS Certificate Management with ACM:**
   Seamlessly provision, manage, and deploy SSL/TLS certificates with AWS Certificate Manager (ACM). Eliminate manual tasks like purchasing, uploading, and renewing certificates, ensuring secure connections with AWS services and internal resources.

4. **Custom DNS Configuration:**
   Tailor a custom DNS domain name to direct to the CloudFront distribution, allowing access to your resume at a personalized address like my-name-resume-website.com. Use Amazon Route 53 or your preferred DNS provider for this purpose.

5. **Lambda Function for Web App Integration:**
   Develop a Lambda function to efficiently handle requests from your web application, facilitating seamless communication with the DynamoDB database.

6. **DynamoDB Visitor Counter Optimization:**
   Ensure the visitor counter efficiently retrieves and updates its count in DynamoDB. Opt for on-demand pricing to minimize costs, especially for projects involving moderate data storage or retrieval.

7. **Configuring Amazon Simple Email Service (Amazon SES):**
   Receive emails confidently without relying on an on-premises SMTP server. Leverage the Amazon SES API or SMTP interface for seamless email configuration.

8. **AWS Lambda and Amazon SES Integration:**
   Develop a Python-based Lambda function with the logic for sending emails using Amazon SES. Specify recipient addresses to streamline the email sending process.

---

## Troubleshooting 

“Zen and the Art of Motorcycle Maintenance: An Inquiry into Values” by [Robert M. Pirsig](https://en.wikipedia.org/wiki/Zen_and_the_Art_of_Motorcycle_Maintenance)
	
"Two kinds of logic are used, inductive and deductive. Inductive inferences start with observations of the machine and arrive at general conclusions. For example, if the cycle goes over a bump and the engine misfires, and then goes over another bump and the engine misfires, and then goes over another bump and the engine misfires, and then goes over a long smooth stretch of road and there is no misfiring, and then goes over a fourth bump and the engine misfires again, one can logically conclude that the misfiring is caused by the bumps. That is induction: reasoning from particular experiences to general truths. 

Deductive inferences do the reverse. They start with general knowledge and predict a specific observation. For example, if, from reading the hierarchy of facts about the machine, the mechanic knows the horn of the cycle is powered exclusively by electricity from the battery, then he can logically infer that if the battery is dead the horn will not work. That is deduction. 

Solution of problems too complicated for common sense to solve is achieved by long strings of mixed inductive and deductive inferences that weave back and forth between the observed machine and the mental hierarchy of the machine found in the manuals. The correct program for this inter-weaving is formalized as scientific method." (Pirsig, 2008, p. 107)

**TLDR**: Inductive and deductive logic are used to solve complex problems. ***Inductive*** inferences start with observations and lead to general conclusions, while ***deductive*** inferences start with general knowledge and predict specific observations. The solution to complex problems often involves a mix of both, weaving back and forth between observed phenomena and established knowledge, formalized as the scientific method.

---

### Scientific method example from the book "Zen and the Art of Motorcycle Maintenance" by Robert M. Pirsig

1. **Statement of the problem**
	- Motorcycle: What is wrong with Cycle?
2. **Hypothesis as to the cause of the problem**
	- The trouble is in the electrical system.
3. **Experiment to test each hypothesis (T/F)**
	- The point at which the electrical system directly causes the engine to fire is at the spark plugs, and if you don't test here, at the output of the electrical system, you will never really know whether the failure is electrical or not.
4. **Predicted results of the experiments**
	- To test properly the mechanic removes the plug and lays it against the engine so that the base around the plug is electrically grounded, kicks the starter lever and watches the spark plug gap for a blue spark. If there isn't any he can conclude one of two things: A) there is an electrical failure or B) his experiment is sloppy.
5. **Observed results of the experiments**
	- If he is experienced he will try it a few more times, checking connections, trying every way he can think of to get that plug to fire. Then, if he can't get it to fire, he finally concludes that A) is correct, there's an electrical failure, and the experiment is over. He has proved that his hypothesis is correct.
6. **Conclusions from the results of the experiments**
	- In the final category, conclusions, skill comes in stating no more than the experiment has proved. It hasn't proved that when he fixes the electrical system the motorcycle will start. There may be other things wrong. But he does know that the motorcycle isn't going to run until the electrical system is working and he sets up the next formal question: ``Solve problem: what is wrong with the electrical system?''

---
### When tackling challenges that may surface during the cloud resume project, we can adopt a similar approach. 
 
Example: 
1. **Statement of the problem**
	-  Website: What is wrong CloudFront?
2.  **Hypothesis as to the cause of the problem**
	- The outdated files might be cached in both CloudFront and users' browsers, preventing the display of the updated content on the live website.
3. **Experiment to test each hypothesis (T/F)**
	- To address the potential caching issue: **Initiate an invalidation** for the updated files in CloudFront aiming to clear the CloudFront cache.
4. **Predicted results of the experiments**
	- Verification that cached copies in CloudFront have been invalidated.
5. **Observed results of the experiments**
	- Confirmation that cached copies were indeed stored in CloudFront.
6. **Conclusions from the results of the experiments**
	- The process to invalidate updated files in CloudFront was successful in clearing all cached copies. The live website reflected the changes from the recently updated actions.
	

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wan6kz0tzokenxe5671h.png)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2fmq27azhx01z2n8hxes.png)




As we navigate the problem-solving process, we adhere to the principles of the scientific method.

### TODO 
- Test code.
- Leverage Terraform to orchestrate frontend development tasks. 
- Improve doccumentation on github.
- Integrate Ansible into CI/CD pipeline to automate infrastructure provisioning and configuration as part of the deployment process.

---

### Resources / References / Acknowledgements
https://github.com/d0we007
https://cloudresumechallenge.dev/docs/the-challenge/aws/
https://www.youtube.com/@openupthecloud/featured
https://learn.cantrill.io/