The course is part of these learning paths
Getting Started with CloudFormation
Setting up our first CloudFormation Stack
Modern IT infrastructures can be quite complex and are usually built from many distinct components: computing instances, load balancers, storage volumes, CDNs, caching nodes, one or more database clusters, etc. You need to setup each component specifically for the environment that you are using (like production, staging, development, etc.), to keep them updated and to remove or swap components due to software changes. CloudFormation is a great tool that helps system administrators by managing these details automatically.
In this course, CloudAcademy's Senior Devops Engineer, Antonio Angelino, will discuss how AWS CloudFormation works and how you can use it to build scalable infrastructures. AWS CloudFormation allows you to easily create sets of cloud resources such as Amazon EC2 instances, CloudFront distributions, RDS database instances and other services by just writing a template file.
Who should take this course
This course is on the intermediate level, so you should have some experience with AWS and its basic services like EC2, ELB, AutoScaling, and RDS. Also, some knowledge of Highly Availability concepts, the JSON file format, and Wordpress can be helpful to understand the ideas behind the practical part of the course and the template's syntax.
If you need to learn more about the AWS services cited here, please check our collection of AWS courses, in particular the courses about EC2 and RDS. Also, if you want to test your knowledge on the basic topics covered in this course, check out our AWS questions.
During the previous lecture, we started the creation of our WordPress sample infrastructure. And now we'll focus on the creation process, in order to understand what's happening under the hood. The stack dashboard of CloudFormation is composed by the stack list, and a pane with different tabs. The current open tab is events, and it lists all occurred stack events. The first created resource is the wait condition handler, and the second one is the load balancer, and then both EC2 security groups and RDS DB security groups are created.
We can see the created resources by opening the EC2 service page. Right now there are no instances because CloudFormation didn't create them yet.
There's a load balancer instead, and no auto-scaling groups. Coming back to the CloudFormation dashboard, we can notice that the creation of our database instances has begun. The MySQL database cluster creation can take up to 30 minutes to complete because we decided to use multiple availability zones. Amazon RDS has to create a primary database instance, and a second one in a different availability zone. This is the configuration for production environments, because RDS performs an automatic failover to the standby instance if the primary one goes offline say, due to an Amazon infrastructure failure. We can check the database cluster creation by opening the RDS dashboard. The status of our RDS infrastructure is backing up. Security groups are properly linked, and all database settings were configured according to our template parameters. We can also check the created security groups. Let's go to the EC2 dashboard, and then to security groups section.
CloudFormation created a security group for the database instances, another one for our future EC2 instances, and the last one for the load balancer.
After a few minutes, our database cluster is ready, and CloudFormation has been passed to the next step, starting the creation of the auto-scaling group and web instances.
As we can see, there's a new auto-scaling scaling group in our AWS account. Auto-scaling will automatically scale our EC2 capacity up to 5 instances during demand spikes, and down during lows.
Everything is already configured. Even one of the two EC2 instances is up and running. Coming back to CloudFormation dashboard, we can notice that the stack creation is now stuck on wait condition, resource creation. Right now, CloudFormation is configuring our EC2 instances, installing Apache, PHP, downloading and configuring the latest versions of WordPress. After about three minutes, the instance configuration will finish, and the stack status will be changed to create_complete. CloudFormation successfully created our WordPress stack using the specified template document, and our parameter values. And it returned the website URL as final output. Following the website URL link, we can finalize the WordPress installation by choosing the blog title, the admin username and password, and so on. After a few seconds, we can log in and start writing our articles.
Thanks for watching this course. If you want to know more about auto-scaling, Amazon RDS, or any of the other services used, please watch the related CloudAcademy courses. Thanks.
About the Author
Antonio is an IT Manager and a software and infrastructure Engineer with 15 years of experience in designing, implementing and deploying complex webapps.
He has a deep knowledge of the IEEE Software and Systems Engineering Standards and of several programming languages (Python, PHP, Java, Scala, JS).
Antonio has also been using and designing cloud infrastructures for five years, using both public and private cloud services (Amazon Web Services, Google Cloud Platform, Azure, Openstack and Vmware vSphere).
During his past working experiences, he designed and managed large web clusters, also developing a service orchestrator for providing automatic scaling, self-healing and a Disaster Recovery Strategy.
Antonio is currently the Labs Product Manager and a Senior DevOps Engineer at Cloud Academy; his main goal is providing the best learn-by-doing experience possible taking care of the Cloud Academy Labs platform.