This file contains hidden or 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 | |
| profile = "my_profile" | |
| region = "my_region" | |
| expiration = 3600 # one hour in seconds | |
| bucket = "my_bucket" | |
| key = "my_file_name" | |
| session = boto3.session.Session(profile_name=profile, region_name=region) |
This file contains hidden or 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
| // Update the variables below from the output of your terraform apply, assuming the attachment name is "attachment". | |
| // Then paste this into https://play.golang.org/ and run it. This example is here https://play.golang.org/p/UgXxMqbdxH | |
| // Copied from the terraform code directly at https://github.com/hashicorp/terraform | |
| // output "attachment_name" { | |
| // value = "${aws_volume_attachment.attachment.device_name}" | |
| // } | |
| // output "attachment_instance_id" { | |
| // value = "${aws_volume_attachment.attachment.instance_id}" |
This file contains hidden or 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
| CREATE EXTERNAL TABLE cloudtrail_logs ( | |
| eventversion STRING, | |
| userIdentity STRUCT< | |
| type:STRING, | |
| principalid:STRING, | |
| arn:STRING, | |
| accountid:STRING, | |
| invokedby:STRING, | |
| accesskeyid:STRING, | |
| userName:STRING, |
This file contains hidden or 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
| #!/bin/bash | |
| # Given the name of an instance, it will lookup the instance ID and download the UserData. | |
| NAME=$1 | |
| PROFILE=$2 | |
| REGION=$3 | |
| if [ -z $NAME ] ; then | |
| echo "Usage: $0 <instance_name>" |
This file contains hidden or 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
| #!/bin/bash | |
| # Given the name of an instance, it will lookup the instance ID and download the UserData. | |
| NAME=$1 | |
| if [ -z $NAME ] ; then | |
| echo "Usage: $0 <instance_name>" | |
| exit 1 | |
| fi |
This file contains hidden or 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
| CREATE EXTERNAL TABLE cloud_trail ( | |
| Records ARRAY< STRUCT< eventName: STRING, | |
| requestParameters: STRUCT< instancesSet: STRUCT< items: ARRAY< STRUCT< instanceId: STRING >>>, | |
| volumeSet: STRUCT< items: ARRAY< STRUCT< volumeId: STRING > > > >, | |
| eventType: STRING, | |
| eventSource: STRING, | |
| sourceIPAddress: STRING, | |
| userIdentity: STRUCT< arn: STRING, | |
| principalId: STRING, | |
| accountId: STRING, |
This file contains hidden or 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
| aws ec2 describe-instance-attribute --instance-id [id] --region us-west-2 --profile [profile] --attribute userData --query '{data:UserData}' --output text | awk '{print $NF}' | base64 -d > filename.userdata |
This file contains hidden or 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
| #set -o xtrace | |
| echo "please copy the output of this script and send it to the network team so they can diagnose your issue" | |
| DESTINATION=destination.foo.com | |
| PORT=8089 | |
| echo "Dumping local network data" | |
| ifconfig | |
| # get the routing table |
This file contains hidden or 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
| #!/bin/sh | |
| # ---- website-checker.sh ---- | |
| # Pings a list of websites using cURL to see if they are up and | |
| # there are no errors. If there are problems, we send an email using mailx | |
| # to let ourselves know about the problem. | |
| ################################################################################ | |
| # This is a path to a plain text list of URLs to check, one per line | |
| # Make sure this uses proper unix newline characters or you will get 400 Bad Request errors | |
| # when you try to curl the URLs |
This file contains hidden or 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
| Description: This template deploys a VPC, with a pair of public and private subnets spread | |
| across two Availability Zones. It deploys an internet gateway, with a default | |
| route on the public subnets. It deploys a pair of NAT gateways (one in each AZ), | |
| and default routes for them in the private subnets. | |
| Parameters: | |
| EnvironmentName: | |
| Description: An environment name that is prefixed to resource names | |
| Type: String |