This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SessionParser { | |
static void main(String[] args) { | |
def users = [:] | |
def records = new File(/vpn.txt/) // VPN log file | |
records.eachLine {record -> | |
if (record ==~ /.*Full_Tunnel.*/) { // Use this regex to catch lines you know will be interesting | |
def userMatcher = record =~ /userName/ // Write a regex to catch the username |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"Parameters": { | |
"EnvironmentParameter": { | |
"Type": "String", | |
"Default": "Prod", | |
"AllowedValues": [ | |
"Test", | |
"Prod" | |
], | |
"Description": "Enter the environment you are deploying your stack into" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"Mappings": { | |
"Subnet": { | |
"Environment": { | |
"Test": "subnet-2udye763", | |
"Prod": "subnet-jd83udjed" | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"SubnetId": { | |
"Fn::FindInMap": [ | |
"Subnet", | |
"Environment", | |
{ | |
"Ref": "Environment" | |
}] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"AWSTemplateFormatVersion": "2010-09-09", | |
"Metadata": { | |
"AWS::CloudFormation::Designer": { | |
"d44d7b48-13cf-47fc-b755-39115ba78fff": { | |
"size": { | |
"width": 310, | |
"height": 300 | |
}, | |
"position": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
# Create boto3 ec2 resource | |
ec2 = boto3.resource('ec2') | |
# Retrieve instances with a name tag that contains Webserver | |
filters = [{'Name':'tag:instanceSchedule', 'Values': ['*Webserver*']}] | |
instances = ec2.instances.filter(Filters=filters) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(Get-EC2Instance -filter @( @{name='tag:Name';values="*Webserver*"})).instances |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(Get-EC2Instance -filter @( @{name='tag:Name';values="*Webserver*"})).instances | where {$_.InstanceType -eq "t2.micro"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
# Setup cloud watch logging | |
logger.setLevel(logging.WARNING) | |
# Create boto3 EC2 resource | |
ec2 = boto3.resource('ec2') | |
def lambda_handler(event, context): | |
logger = logging.getLogger() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Effect": "Allow", | |
"Principal": { | |
"Service": "lambda.amazonaws.com" | |
}, | |
"Action": "sts:AssumeRole" | |
} |
OlderNewer