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
# This example is from https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-sub.html. | |
UserData: | |
Fn::Base64: | |
!Sub | | |
#!/bin/bash -xe | |
yum update -y aws-cfn-bootstrap | |
/opt/aws/bin/cfn-init -v --stack ${AWS::StackName} --resource LaunchConfig --configsets wordpress_install --region ${AWS::Region} | |
/opt/aws/bin/cfn-signal -e $? --stack ${AWS::StackName} --resource WebServerGroup --region ${AWS::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
MIT License | |
Copyright (c) 2018 Jeff Loughridge | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is | |
furnished to do so, subject to the following conditions: |
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 | |
# USAGE: ./create-aws-console-user.sh $GROUPNAME $USERNAME $PASSWORD | |
# http://docs.aws.amazon.com/IAM/latest/UserGuide/id_users_create.html#id_users_create_cliwpsapi | |
# Create administrator group | |
aws iam create-group --group-name $1 |
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 | |
# From fitblip at https://github.com/aws/aws-cli/issues/1777#issuecomment-284262414 | |
for region in `aws ec2 describe-regions --output text | cut -f3` | |
do | |
echo -e "\nListing Instances in region:'$region'..." | |
aws ec2 describe-instances --region $region | jq '.Reservations[] | ( .Instances[] | {state: .State.Name, name: .KeyName, type: .InstanceType, key: .KeyName})' | |
done |
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 -xe | |
yum update -y | |
yum install -y httpd | |
systemctl start httpd | |
systemctl enable httpd | |
usermod -a -G apache ec2-user | |
chown -R ec2-user:apache /var/www | |
chmod 2775 /var/www | |
find /var/www -type d -exec chmod 2775 {} \; | |
find /var/www -type f -exec chmod 0664 {} \; |
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
# From https://stackoverflow.com/questions/47644034/cloudformation-error-value-of-property-networkinterfaces-must-be-a-list-of-obje | |
MyAppNetworkInterface: | |
Type: AWS::EC2::NetworkInterface | |
Properties: | |
SubnetId: !Ref SubnetPrivate | |
MyApp: | |
Type: AWS::EC2::Instance | |
Properties: |
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
jeffl@ubuntu:~/vault_testing$ cat vars/secrets.yml | |
--- | |
username: jeffl | |
password: secretpassword | |
jeffl@ubuntu:~/vault_testing$ | |
jeffl@ubuntu:~/vault_testing$ echo "my_vault_pass" > vault_pass | |
jeffl@ubuntu:~/vault_testing$ chmod go-r vault_pass | |
jeffl@ubuntu:~/vault_testing$ ansible-vault encrypt --vault-id vault_pass vars/secrets.yml |
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
# Adapted from https://stackoverflow.com/questions/35869985/datetime-datetime-is-not-json-serializable | |
import datetime | |
import json | |
import boto3 | |
def datetime_handler(x): | |
if isinstance(x, datetime.datetime): | |
return x.isoformat() |
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
//logical-interface[name='lo0.0']/address-family[address-family-name='inet']/interface-address[ifa-flags/ifaf-current-primary]/ifa-local |
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
# This gist demonstrates how to use PyEZ's get_config RPC | |
from jnpr.junos import Device | |
from lxml import etree | |
def example_one(dev): | |
# This uses default options | |
cnf = dev.rpc.get_config() | |
print etree.tostring(cnf) |