swoodford / aws Goto Github PK
View Code? Open in Web Editor NEWA collection of bash shell scripts for automating various tasks with Amazon Web Services using the AWS CLI and jq.
License: Apache License 2.0
A collection of bash shell scripts for automating various tasks with Amazon Web Services using the AWS CLI and jq.
License: Apache License 2.0
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Describe the solution you'd like
A clear and concise description of what you want to happen.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
Your tools look awesome! ๐
Is there a way to automate the creation of an EnvironmentHealth
alarm for a given Elastic Beanstalk application? I need to create the exact same alarm for a host of applications, each of which has multiple environments.
e.g.
I have foo-app with foo-app-production and foo-app-staging
I have bar-app with bar-app-production and bar-app-staging
All 4 of those need to message a SNS topic on both Alarm and OK.
Enable 'overwrite' flag, basically do you want to overwrite an existing retention period.
This would be helpful in case some logs already have a policy of say 30 days, but for buckets with no policy defined we want a max of 180 days retention.
aws/cloudwatch-logs-retention-policy.sh
Line 10 in fd6fc2b
Day1
Is your feature request related to a problem? Please describe.
Repeating yourself
Describe the solution you'd like
Pull the configuration into a single file
Describe alternatives you've considered
N/A
Additional context
N/A
You have this atop all of your scripts and if this ever changes, for whatever reason (which it probably won't), you'll be copy/pasting it all over again throughout. Also if someone wants to add some initialization steps beyond what is specified here you may benefit them as they could simply add to this included file. So instead of this:
if ! grep -q aws_access_key_id ~/.aws/config; then
if ! grep -q aws_access_key_id ~/.aws/credentials; then
echo "AWS config not found. Running \"aws configure\"."
exit 1
fi
fi
Move it to _pre_command.sh
and improve it:
#!/usr/bin/env bash
# Look for the AWS CLI
if test ! $(which aws); then
echo "Installing AWS CLI..."
brew install awscli
fi
# Look for the AWS configuration
if ! grep -q aws_access_key_id ~/.aws/config; then
if ! grep -q aws_access_key_id ~/.aws/credentials; then
echo 'AWS configuration was not found. Running "aws configure"...'
aws configure
fi
fi
Then in all of your scripts simply put:
$SWOODFORD_AWS_DIRECTORY/_pre_command.sh
Or something more fancy (but that I think isn't really necessary):
$SWOODFORD_AWS_DIRECTORY/_pre_command.sh || sh -c 'echo; echo "The file \"\$SWOODFORD_AWS_DIRECTORY/_pre_command.sh\" was not found or executable! Please see this page for help: https://github.com/swoodford/aws"'
And then you can put this in an install.sh
script:
#!/usr/bin/env bash
# Look for Homebrew and install it if not found
if test ! $(which brew); then
echo "Installing homebrew..."
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi
# Get the code
git clone https://github.com/swoodford/aws.git ~/.swoodford_aws
# Set this (probably not needed)
export SWOODFORD_AWS_DIRECTORY=~/.swoodford_aws
# Add SWOODFORD_AWS_DIRECTORY variable for reference
grep -q -i -F 'SWOODFORD_AWS_DIRECTORY' ~/.bash_profile || sh -c 'echo "SWOODFORD_AWS_DIRECTORY=\"~/.swoodford_aws"\" >> ~/.bash_profile'
# Add SWOODFORD_AWS_DIRECTORY to the PATH
grep -q -i -F 'PATH="~/.swoodford_aws' ~/.bash_profile || sh -c 'echo "PATH=\"~/.swoodford_aws:\$PATH\"" >> ~/.bash_profile'
Then you can tell users "To simply install these scripts run the following:
sh -c "$(curl -fsSL https://raw.githubusercontent.com/swoodford/aws/master/install.sh)" > /dev/null
"
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.