Posts

Introduction to IaC: Deploying Data infrastructure to Azure using Terraform (Part 4 - Using Github)

Image
  In Part 1 , we explain the basics and prerrequisites to work with Terraform. In Part 2 , we created our first Azure resource. In Part 3 , we deployed our fist solution (Azure SQL database) using multiple resources. On this post, we will integrate Terraform to use the Version Control System Git, implemented using GitHub . Version control is outside the scope of this post, but if you want to learn more about it, you can check these excellent resources: Introduction to version control with Git Introduction to GitHub Automate your workflow with GitHub Actions   Manage the lifecycle of your projects on GitHub   OK, once you have a good idea of what VCS and Github are about, we can integrate it into our Terraform solution and use it as a external repository for our IaC. For simplicity, we will use the same folder and code from the previous post : cd C: \T erraform \T erraform_AZ_example code . Make sure the .gitignore file is in place, since we will source it and is a good practice to in

Introduction to IaC: Deploying Data infrastructure to Azure using Terraform (Part 3 - Azure SQL Database)

Image
In Part 1 , we explain the basics and prerrequisites to work with Terraform. In Part 2 , we created our first Azure resource. On this post we will create an Azure SQL Database and configure it so we can access it right away. Example 2: Deploy and configure an Azure SQL database To create an Azure SQL database, we need at least the following: Resource group (we already have it from the previous example) Azure SQL Server Azure SQL database At least one firewall rule We can obtain code snippets on each resource from the Terraform provider documentation we checked on the previous example: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs We proceed to add each component on the main.tf file (do not delete the previous code we have there) At the end we should have something like this (just check resource names and parameters to match what you want.) terraform { required_providers { azurerm = { source = "hashicorp/azurerm" version = "3.

Introduction to IaC: Deploying Data infrastructure to Azure using Terraform (Part 2 - our first Azure resource)

Image
Continuing our Part 1 , we already set up our environment, we can now setup our very first example (do not worry if is too simple at this point, but this is just to understand how it works). Example 1: Deploy an Azure Resource Group I think the Azure Resource Group is the most basic Azure resource, so we will verify our setup is ok by deploying one. First, create your project folder on your local machine, in my case I am using C:\Terraform\Terraform_AZ_example but you can use any path you want. Then, open that folder in VSCode: cd C:\Terraform\Terraform_AZ_example code . Or use the GUI to open the folder:   Once opened, I like, as a best practice to add this .gitignore file even when you work locally, so sensitive information and Terraform state is not uploaded if you decide source to GitHub: # Local .terraform directories **/. terraform /* # .tfstate files *. tfstate *. tfstate .* # Crash log files crash . log crash .*. log # Exclude all .tfvars files, which are likely

Introduction to IaC: Deploying Data infrastructure to Azure using Terraform (Part 1 - Intro and prerequisites)

Image
Introduction One integral part of modern Continuous Integration and Continuous Development (CI/CD) pipelines is the ability to create the underlying infrastructure as part of the pipeline in a consistent and repeatable manner. Infrastructure as Code (IaC) offers this capability, allowing us to automate and deploy multi-cloud infrastructure as definition scripts. This approach helps us to reduce time invested in provisioning the infrastructure, as well as reducing human errors or misconfigurations.  The infrastructure can also be redeployed to other environments knowing that the configuration will be the same each time. Although Azure offers ARM templates and AWS offers CloudFormation, these are just for its respective cloud provider. Which option do we have if we need an enterprise-grade solution that supports multi-cloud environments and can integrate with our CI/CD pipelines? Terraform is a declarative, open source IaC tool that can deploy to multiple cloud providers and offers a gr

Install Python on Windows

Image
Python is the most famous development language today. This is because is open-source, scalable and robust. It can run in almost any device with a processor (or microprocessor, we will see that in coming posts) and is very simple to use and learn, even if you don't have any programming backgroud or experience. Start using it is very simple and you can learn the basics in the official site .   Installing Python For windows systems, you can download the latest version here . Once downloaded, open the executable file as administrator. Then, for the uses we will give on the articles on this site, please install it this way: Make sure you have selected the add Pyton to PATH option - This will allow us to run the Python engine from multiple sources (As is intended for use on multiple applications) .   Make sure you install Python for all users - This will allow usto run the script commands .   Select PIP feature - This is used to install adittional libraries and functionalities, one of

Checking Azure SQL DB service tier via T-SQL

Image
If you have to manage or work with an Azure SQL database and want to know what service tier the database is currently operating, but you don't have access to the Azure subscription or CLI. Or you want to know the status of the service tier after a scale up or scale down, directly from the database; you can do it via T-SQL Just query the sys.database_service_objectives DMO to obtain this information, this will give information about the service tier, and also will tell you if the database is part of an elastic pool or not. Basic usage (in the context of the database you need the information): SELECT * FROM sys.database_service_objectives; This will return the following information for the current database: I am running on a General Purpose tier with 1 VCore What if you want the information for all the databases created? Just change the context to the master database and execute the following query: SELECT D.name AS DB , D.create_date , SO.edition , SO.service_o

Administration Basics: Point in time recovery

Image
Nowadays, data is a precious asset for companies today. If you are a database administrator (by decision or by mistake) or simply you are the "IT guy," you have the mission of guarantee all the data is backed up and accessible for recovery. Trust me, even when you could think you have the more reliable hardware on the planet, or you have multiple database replicas around the globe, anything can happen (a user deleting an entire schema by mistake, an application updating the wrong records, some process crashing, a lot of things can happen). So trust me and don't question me, just backup all your databases regularly. The Backup/restore strategy is a broad topic, so for this post, we will focus on the restore activity, so if you don't know how to back up a database yet, you can start here . What do we need to know? I like to think of the SQL backups like a pyramid, like this: Pyramid of backups For restoring your database to a particular time, you mu