1. Answers
  2. Deploy MinIO on Azure Virtual Machines

How Do I Use MinIO With Azure Virtual Machines?

Introduction

This guide provides a comprehensive walkthrough on deploying MinIO, a high-performance object storage system, on Azure Virtual Machines using Pulumi. The objective is to set up a fully functional MinIO environment by creating necessary Azure resources such as a resource group, virtual network, subnet, public IP, network interface, and a virtual machine. Finally, MinIO will be installed and configured on the virtual machine to ensure data storage capabilities.

Step-by-Step Process

Step 1: Provision an Azure Resource Group

Begin by creating a resource group in Azure, which will hold all the resources needed for the deployment.

Step 2: Set Up Networking Components

  • Virtual Network: Create a virtual network to provide an isolated and secure environment for your resources.
  • Subnet: Establish a subnet within the virtual network to segment the network and allocate IP addresses.
  • Public IP: Generate a public IP address to allow external access to the virtual machine.
  • Network Interface: Configure a network interface to connect the virtual machine to the subnet and associate it with the public IP.

Step 3: Create and Configure the Virtual Machine

  • Virtual Machine Setup: Deploy a virtual machine with the specified hardware and operating system configurations.
  • Operating System Configuration: Install necessary software packages and download the MinIO binary.
  • MinIO Installation: Set up users, directories, and system services to run MinIO.
  • Service Configuration: Enable and start the MinIO service to ensure it runs on boot.

Key Points

  • Resource Group: Centralized management of Azure resources.
  • Networking: Secure and organized network setup using virtual networks and subnets.
  • Public Accessibility: Public IP configuration for VM access.
  • VM Configuration: Proper setup and installation of MinIO on the virtual machine.
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure-native";

// Create an Azure Resource Group
const resourceGroup = new azure.resources.ResourceGroup("resourceGroup", {
    resourceGroupName: "minio-rg",
    location: "WestUS",
});

// Create a Virtual Network
const virtualNetwork = new azure.network.VirtualNetwork("virtualNetwork", {
    resourceGroupName: resourceGroup.name,
    location: resourceGroup.location,
    addressSpace: { addressPrefixes: ["10.0.0.0/16"] },
});

// Create a Subnet
const subnet = new azure.network.Subnet("subnet", {
    resourceGroupName: resourceGroup.name,
    virtualNetworkName: virtualNetwork.name,
    addressPrefix: "10.0.1.0/24",
});

// Create a Public IP
const publicIp = new azure.network.PublicIPAddress("publicIp", {
    resourceGroupName: resourceGroup.name,
    location: resourceGroup.location,
    publicIPAllocationMethod: "Dynamic",
});

// Create a Network Interface
const networkInterface = new azure.network.NetworkInterface("networkInterface", {
    resourceGroupName: resourceGroup.name,
    location: resourceGroup.location,
    ipConfigurations: [{
        name: "ipconfig1",
        subnet: { id: subnet.id },
        publicIPAddress: { id: publicIp.id },
    }],
});

// Create a Virtual Machine
const vm = new azure.compute.VirtualMachine("vm", {
    resourceGroupName: resourceGroup.name,
    location: resourceGroup.location,
    networkProfile: { networkInterfaces: [{ id: networkInterface.id }] },
    hardwareProfile: { vmSize: "Standard_B1s" },
    osProfile: {
        computerName: "minio-vm",
        adminUsername: "adminuser",
        adminPassword: "Password1234!",
        customData: `#!/bin/bash
                     sudo apt-get update
                     sudo apt-get install -y wget
                     wget https://dl.min.io/server/minio/release/linux-amd64/minio
                     chmod +x minio
                     sudo mv minio /usr/local/bin
                     sudo useradd -r minio-user -s /sbin/nologin
                     sudo chown minio-user:minio-user /usr/local/bin/minio
                     sudo mkdir /usr/local/share/minio
                     sudo chown minio-user:minio-user /usr/local/share/minio
                     sudo mkdir /etc/minio
                     sudo chown minio-user:minio-user /etc/minio
                     echo 'MINIO_ACCESS_KEY=minioadmin' | sudo tee -a /etc/default/minio
                     echo 'MINIO_SECRET_KEY=minioadmin123' | sudo tee -a /etc/default/minio
                     sudo curl -O https://raw.githubusercontent.com/minio/minio-service/master/linux-systemd/minio.service
                     sudo mv minio.service /etc/systemd/system/
                     sudo systemctl daemon-reload
                     sudo systemctl enable minio
                     sudo systemctl start minio
                     `,
    },
    storageProfile: {
        osDisk: {
            name: "osdisk",
            caching: "ReadWrite",
            createOption: "FromImage",
            managedDisk: { storageAccountType: "Standard_LRS" },
        },
        imageReference: {
            publisher: "Canonical",
            offer: "UbuntuServer",
            sku: "18.04-LTS",
            version: "latest",
        },
    },
});

export const publicIpAddress = publicIp.ipAddress;

Conclusion

This guide demonstrated how to deploy MinIO on an Azure Virtual Machine using Pulumi. By following the outlined steps, you created essential networking components, provisioned a virtual machine, and successfully installed MinIO. The public IP address, which was exported, allows you to access the MinIO service externally, completing the setup for a robust storage solution.

Deploy this code

Want to deploy this code? Sign up for a free Pulumi account to deploy in a few clicks.

Sign up

New to Pulumi?

Want to deploy this code? Sign up with Pulumi to deploy in a few clicks.

Sign up