Skip to content

Instantly share code, notes, and snippets.

View mikepfeiffer's full-sized avatar
🏠
Working from home

Mike Pfeiffer mikepfeiffer

🏠
Working from home
View GitHub Profile
@mikepfeiffer
mikepfeiffer / stress.sh
Created January 27, 2019 21:05
Install Stress Utility on Amazon Linux 2
sudo amazon-linux-extras install epel -y
sudo yum install stress -y
@mikepfeiffer
mikepfeiffer / gist:7a3a8d12a42ec705233ceee3f3844a35
Last active April 2, 2024 13:02
Create App Service via Azure CLI
az group create -n webapps-dev-rg -l westus2
az appservice plan create --name webapps-dev-plan \
--resource-group webapps-dev-rg \
--sku s1 \
--is-linux
az webapp create -g webapps-dev-rg \
-p webapps-dev-plan \
-n mp10344884 \
@mikepfeiffer
mikepfeiffer / CreateWebApp.ps1
Last active March 12, 2024 22:40
Create App Service via Azure PowerShell
# Create variables
$webappname = "mywebapp$(Get-Random)"
$rgname = 'webapps3-dev-rg'
$location = 'westus2'
# Create a resource group
New-AzResourceGroup -Name $rgname -Location $location
# Create an App Service plan in S1 tier
New-AzAppServicePlan -Name $webappname -Location $location -ResourceGroupName $rgname -Tier S1
@mikepfeiffer
mikepfeiffer / gist:7c949e2d04c9e51ef204fb9a7f3d2978
Last active January 21, 2024 20:37
Userdata script to setup a basic web page with instance id and tag instance
#!/bin/bash
yum install httpd -y
/sbin/chkconfig --levels 235 httpd on
service httpd start
instanceId=$(curl http://169.254.169.254/latest/meta-data/instance-id)
region=$(curl http://169.254.169.254/latest/dynamic/instance-identity/document | grep region | awk -F\" '{print $4}')
echo "<h1>$instanceId</h1>" > /var/www/html/index.html
aws ec2 create-tags --resources "$instanceId" --tags Key=Name,Value="PROD-$instanceId" --region "$region"
@mikepfeiffer
mikepfeiffer / wordpress-linux-azure.sh
Last active November 1, 2023 10:44
Build a Standalone Wordpress LAMP Server on Azure
#!/bin/bash
# Tutorial: Install a LAMP stack on an Azure Linux VM
# https://docs.microsoft.com/en-us/azure/virtual-machines/linux/tutorial-lamp-stack
# Create the VM Resource Group
az group create --name LAMP-STACK-RG --location westus2
# Create the VM
az vm create \
@mikepfeiffer
mikepfeiffer / gist:4d9386afdcceaf29493a
Created March 19, 2016 22:54
EC2 UserData script to install CodeDeploy agent
#!/bin/bash
yum install -y aws-cli
cd /home/ec2-user/
aws s3 cp 's3://aws-codedeploy-us-east-1/latest/codedeploy-agent.noarch.rpm' . --region us-east-1
yum -y install codedeploy-agent.noarch.rpm
@mikepfeiffer
mikepfeiffer / apache2.sh
Created January 27, 2019 16:26
EC2 Bootstrap Script for Apache v2
#!/bin/bash
yum update -y
yum install -y httpd
instanceId=$(curl http://169.254.169.254/latest/meta-data/instance-id)
echo "<h1>Hello World from $instanceId</h1>" > /var/www/html/index.html
systemctl start httpd
systemctl enable httpd
@mikepfeiffer
mikepfeiffer / apache.sh
Created January 26, 2019 19:43
EC2 Bootstrap Script for Apache
#!/bin/bash
yum update -y
yum install -y httpd
echo '<h1>Hello World</h1>' > /var/www/html/index.html
systemctl start httpd
systemctl enable httpd
#!/bin/bash
az appservice plan create \
-g webapps-dev-rg \
-n gm-asp-dev-02 \
--is-linux \
--number-of-workers 1 \
--sku S1
az webapp create \
@mikepfeiffer
mikepfeiffer / NewWebServer.ps1
Created March 9, 2020 18:41
Quick AZ PowerShell Script to Create a Web Server
param(
$Name = 'WEB1',
$Location = 'westus2',
$ResourceGroup = 'WebServers'
)
New-AzResourceGroup -Name $ResourceGroup -Location $Location
$params = @{
Name = $Name