Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
AWS for System Administrators

You're reading from   AWS for System Administrators Build, automate, and manage your infrastructure on the most popular cloud platform – AWS

Arrow left icon
Product type Paperback
Published in Feb 2021
Publisher Packt
ISBN-13 9781800201538
Length 388 pages
Edition 1st Edition
Tools
Arrow right icon
Author (1):
Arrow left icon
Prashant Lakhera Prashant Lakhera
Author Profile Icon Prashant Lakhera
Prashant Lakhera
Arrow right icon
View More author details
Toc

Table of Contents (18) Chapters Close

Preface 1. Section 1: AWS Services and Tools
2. Chapter 1: Setting Up the AWS Environment FREE CHAPTER 3. Chapter 2: Protecting Your AWS Account Using IAM 4. Section 2: Building the Infrastructure
5. Chapter 3: Creating a Data Center in the Cloud Using VPC 6. Chapter 4: Scalable Compute Capacity in the Cloud via EC2 7. Section 3: Adding Scalability and Elasticity to the Infrastructure
8. Chapter 5: Increasing an Application's Fault Tolerance with Elastic Load Balancing 9. Chapter 6: Increasing Application Performance Using AWS Auto Scaling 10. Chapter 7: Creating a Relational Database in the Cloud using AWS Relational Database Service (RDS) 11. Section 4: The Monitoring, Metrics, and Backup Layers
12. Chapter 8: Monitoring AWS Services Using CloudWatch and SNS 13. Chapter 9: Centralizing Logs for Analysis 14. Chapter 10: Centralizing Cloud Backup Solution 15. Chapter 11: AWS Disaster Recovery Solutions 16. Chapter 12: AWS Tips and Tricks 17. Other Books You May Enjoy

Automating AWS RDS MySQL creation using Terraform

So far, we have created a MySQL database using the AWS console. In this section, we will learn how to automate the entire process using Terraform. The whole process is divided into four steps:

  1. We will start with the boilerplate syntax where we specify aws as provider, and the region where we want to create this database (for example, us-west-2, which is in Oregon):
    provider "aws" {
      region = "us-west-2"
    }
  2. In the next step, you need to specify the database subnet group. This is the subnet group that MySQL uses to create the database instance:

    - name: This is the name of the subnet group. For example, you could use rds-db-subnet. If you omit this, Terraform will randomly assign some unique name for you.

    - subnet_ids: Here you specify the list of subnet IDs (for example, subnet-07714eb09171b1f7e and subnet-0cca9fdeb1b95003c – these are the subnet IDs from prod-vpc):

    resource "aws_db_subnet_group...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at R$50/month. Cancel anytime