Skip to content

Instantly share code, notes, and snippets.

View andreaswasita's full-sized avatar

Andreas Wasita andreaswasita

View GitHub Profile
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "Builds a NAT host. **WARNING** This template creates Amazon EC2 instance(s). You will be billed for the AWS resources used if you create a stack from this template.",
"Parameters" : {
"KeyName" : {
"Description" : "Name of an existing EC2 KeyPair to enable SSH access to the instances",
"Type" : "String",
"MinLength": "1",
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "Add a bastion host to an existing VPC. VPC must have an internet gateway already. **WARNING** This template creates an Amazon EC2 instance. You will be billed for the AWS resources used if you create a stack from this template.",
"Parameters" : {
"KeyName" : {
"Description" : "Name of an existing EC2 KeyPair to enable SSH access to the instances",
"Type" : "String",
"MinLength": "1",
"Outputs" : {
"PrivateRouteTableId" : {
"Value" : {"Ref" : "PrivateRouteTable"},
"Description" : "Private Route Table ID"
}
}
}
"Resources" : {
"NATIPAddress" : {
"Type" : "AWS::EC2::EIP",
"Properties" : {
"Domain" : "vpc",
"InstanceId" : { "Ref" : "NATDevice" }
}
},
"Mappings" : {
"AWSNATAMI": {
"us-east-1": {"AMI": "ami-6e9e4b06"},
"us-west-2": {"AMI": "ami-8b6912bb"},
"us-west-1": {"AMI": "ami-1d2b2958"},
"eu-west-1": {"AMI": "ami-14913f63"},
"ap-northeast-1": {"AMI": "ami-27d6e626"}
}
},
"Parameters" : {
"KeyName" : {
"Description" : "Name of an existing EC2 KeyPair to enable SSH access to the instances",
"Type" : "String",
"MinLength": "1",
"MaxLength": "64",
"AllowedPattern" : "[-_ a-zA-Z0-9]*",
"ConstraintDescription" : "can contain only alphanumeric characters, spaces, dashes and underscores."
},
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "Builds a VPC w/ INET Gateway and 3 public subnets. **WARNING** This template creates Amazon EC2 instance(s). You will be billed for the AWS resources used if you create a stack from this template.",
<#
.Synopsis
Creates scheduled tasks to stop Virtual Machines.
.DESCRIPTION
Creates scheduled tasks to stop a single Virtual Machine or a set of Virtual Machines (using
wildcard pattern syntax for the Virtual Machine name).
.EXAMPLE
Stop-AzureVMsOnSchedule.ps1 -ServiceName "MyServiceName" -VMName "testmachine1" -TaskName "Stopt Test Machine 1" -At 5:30PM
Stop-AzureVMsOnSchedule.ps1 -ServiceName "MyServiceName" -VMName "test*" -TaskName "Stop All Test Machines" -At 5:30PM
#>
<#
.SYNOPSIS
Creates scheduled tasks to start Virtual Machines.
.DESCRIPTION
Creates scheduled tasks to start a single Virtual Machine or a set of Virtual Machines (using
wildcard pattern syntax for the Virtual Machine name).
.EXAMPLE
Start-AzureVMsOnSchedule.ps1 -ServiceName "MyServiceName" -VMName "testmachine1" `
-TaskName "Start Test Machine 1" -At 8AM
#Create a Network Security Group
New-AzureNetworkSecurityGroup -Name "DMZ_NSG" -Location Southeast Asia -Label "DMZ NSG SEVNET"
#Add, Update Rules to a NSG
Get-AzureNetworkSecurityGroup -Name "DMZ_NSG" | Set-AzureNetworkSecurityRule -Name RDPInternet-DMZ -Type Inbound -Priority 347 -Action Allow -SourceAddressPrefix 'INTERNET' -SourcePortRange '63389' -DestinationAddressPrefix '10.0.2.0/25' -DestinationPortRange '63389' -Protocol TCP
#Delete a rule from NSG
Get-AzureNetworkSecurityGroup -Name "DMZ_NSG" | Remove-AzureNetworkSecurityRule -Name RDPInternet-DMZ
#Associate a NSG to a Virtual machine