Deploy a high-availability web app using CloudFormation Project FAQ — Udacity Cloud DevOps

  1. What are some good development tools for cloud formation?

CloudFormation Linter

https://github.com/aws-cloudformation/cfn-python-lint

Editor Plugins

https://github.com/aws-cloudformation/cfn-python-lint#editor-plugins

Templeta schema plugin

https://github.com/aws-cloudformation/aws-cloudformation-template-schema

  1. In the project description, it states that we will be deploying the Udagram app, but I don’t seem to be able to find any of the code to pull from an S3 bucket and host. Is the expectation that we write some JS and HTML to pull from an S3 bucket and host on our Infrastructure we are building?

There are no files for the Udagram app

Just create an index.html

that has this text

it works! Udagram, Udacity

ok? 👌

2. It mentions in the project description that there should be some code associated but I don’t seem to see any files anywhere. Am I missing something?

There is no boilerplate code provided from Udacity, you need to create all of the code from scratch.

3. For Project #2 (deploy high-availability website), where is the UserData script and other supporting code mentioned in “Other Considerations” for the project?

You are correct, in the instructions it is mentioned that we are going to provide a UserData, but apparently there is a mistake it is not available.

This is an example of a UserData that you can use:

I am going to explain line by line

#!/bin/bash

This line indicated that we are going to use the bash engine

apt update -y

To ensure that all of your software packages are up to date, perform a quick software update on your instance. This process may take a few minutes, but it is important to make sure that you have the latest security updates and bug fixes

apt install -y httpd

install the Apache web server

systemctl start httpd

Start the Apache web server

wget -P ../../var/www/html https://s3.us-east-2.amazonaws.com/test-udagram-1/index.html

Download an HTML file that I store in a S3 bucket. In this case you will need to create your own S3 bucket, upload your HTML file and make the file publicly accessible

To read more about this you can use this links:

4. I am currently working on the server resources per your question above. However, I am not sure my network is still setup correctly. Should I be able to ping the elastic IP’s from my home computer without using VPN?

  • The first test to ensure that the network is setup correctly is to verify that every resource was successfully created
  • The second test is to manually verify in the AWS console that every resource created has the correct configuration and values
  • The third test it to deploy some simple server resources in that network, like a server in the public subnet and make sure that you can connect to it

5. Does the Cloud DevOps Nanodegree prepares me for the AWS Certified DevOps Engineer — Professional exam?

Yes, the Cloud DevOps Nanodegree prepares you for the AWS Certified DevOps Engineer — Professional exam.

But you need to understand this to prepare any exam:

  • To prepare any exam you need to know how it is going to work and train using sample exams or old exams similar to the current exam. No matter how smart you are or how much you know, to be able to succeed in a difficult exam you need to train. You can be the best runner in the world, but if you never run before a 100m, you are not going to be able to give your best and you can even fail.
  • Prepare with sample exams or old exams. Prepare with sample exams or old exams. Prepare with sample exams or old exams. Prepare with sample exams or old exams. Prepare with sample exams or old exams. Prepare with sample exams or old exams. Prepare with sample exams or old exams. Prepare with sample exams or old exams. Prepare with sample exams or old exams. Prepare with sample exams or old exams. Prepare with sample exams or old exams.
  • There are some topics that are not explained in detail in the Nanodegree, these are:

6. so how would I put an index.html in my code or somewhere else so that when I enter my load balancer (on the internet in real life) and after it directs me into one of my private subnets and into one of my servers that its message will show up

7. does the bucket need to be created in the cloud formation script or can it just be created in the console?

  • The bucket is not created in the cloudformation script, do it manually

8. I am having problems with the load balancer or with the EC2 instance. I don’t know how to verify that the commands in the UserData executed correctly and if the problems are in the EC2 instances.

There are 2 ways to troubleshoot the servers and the UserData:

  1. Test the UserData first by creating a EC2 instances with the same specifications in the LaunchConfiguration. Launch the instance in the EC2 dashboard, NOT in CloudFormation.
  2. Configure your UserData in your CloudFormation script so that you can see the logs of the invocation of the UserData in the System Log.

To troubleshoot issues on your EC2 instance bootstrap without having to access the instance through SSH, you can add code to your user-data bash script that redirects all the output both to the /var/log/user-data.log and to /dev/console. When the code is executed, you can see your user-data invocation logs in your console.

Please look at these tutorials:

9. Unfortunately when I try to connect from my browser I keep getting a 504 Gateway Time-out for the Backup Load Balancer DNS Name url that is output

If you are using a Application Load Balancers, these can the reasons:

Try to Access Logs for Your Application Load Balancer

Load Balancer Checklist

  • The load balancer has the correct type
  • Has a Properties attribute
  • In the Properties, it has the correct security groups, that allow traffic to and from it
  • In the Properties, it has the correct subnets
  • In the Properties, it has the type equal to application
  • The load balancer has a related resource of type TargetGroup
  • The load balancer has a related resource of type Listener
  • The load balancer has a related resource of type ListenerRule

Target Group Checklist

  • The target group has the correct type
  • Has a Properties attribute
  • In the Properties, it has the VPCId
  • In the Properties, it has the Port
  • In the Properties, it has the Protocol equal to HTTP
  • The Target Group has a related resource of type Listener
  • The Target Group has a related resource of type ListenerRule
  • The Target Group has a related resource of type AutoScalingGroup
  • The Target Group is referenced in the AutoScalingGroup with the property TargetGroupARNs

Listener Checklist

  • The Listener has the correct type
  • Has a Properties attribute
  • In the Properties, it has the DefaultActions. For example:
  • In the Properties, it has the LoadBalancerArn
  • In the Properties, it has the Protocol equal to HTTP
  • In the Properties, it has the Port
  • The Listener has a related resource of type ListenerRule
  • The Listener is referenced in the ListenerRule with the property ListenerArn

Listener Rule Checklist

  • The Listener Rule has the correct type
  • Has a Properties attribute
  • In the Properties, it has the DefaultActions. For example:
  • In the Properties, it has the Conditions
  • In the Properties, it has the ListenerArn
  • In the Properties, it has the Priority

9. I am having a problem with the LaunchConfiguration

LaunchConfiguration Checklist

  • The LaunchConfiguration has the correct type
  • Has a Properties attribute
  • In the Properties, it has the UserData
  • You tested the UserData in an EC2 instance and it works
  • You included at the top of the UserData the #!/bin/bash
  • In the Properties, it has the ImageId
  • In the Properties, it has the InstanceType
  • In the Properties, it has the BlockDeviceMappings
  • In the Properties, it has the SecurityGroups
  • In the Properties, it has the LaunchConfigurationName

How to use multiple templates?

You need to create one stack for each template with the create-stack command

How to find the correct imageId for the LaunchConfiguration?

This link will teach you: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/finding-an-ami.html

I want to show this good and short solution:

How to fix in cloudformation that my instances say unhealthy 502 or the logs say “Restart services during package updates without asking”?

Use this code in the LaunchConfiguration

The make sure that you are using an Image of Ubuntu. Select the correct one for your Zone

How to test a UserData for a LaunchConfiguration in AWS?

https://www.youtube.com/watch?v=xOqEQdc_eRo&t=7s

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Oracle ATG Web Commerce to Microservices

OOPs IN JAVA

Pokemon in Unity: Basics of Scriptable Objects

How to use our new Grafana plugin

ESP32 Web Server — Arduino IDE

{UPDATE} Судоку - Головоломка с числами Hack Free Resources Generator

I still keep my other laptop for professional stuff since the environment is set up to

Leaning Into Web3 at an Interesting Time

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Alvaro Andres Pinzon Cortes

Alvaro Andres Pinzon Cortes

More from Medium

AWS Overview

Cloud Computing

How to configure EC2, EBS, and S3 in AWS using AWS CLI

AWS cloud with Robotic Process Automation