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
$ sudo apt update | |
$ sudo apt install python-pip | |
$ pip install --upgrade pip | |
$ pip install awscli --upgrade --user | |
$ export PATH=~/.local/bin:$PATH | |
$ aws | |
usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters] | |
To see help text, you can run: | |
aws help |
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
#!/bin/bash | |
vhostspath="/var/www/vhosts" | |
vhostsused=$(df -m | grep "${vhostspath}" | tr -s ' ' | cut -d ' ' -f3) | |
if [ "${vhostsused}" = "" ]; then | |
vhostsused=$(du -sh "${vhostspath}" | awk '{print $1}') | |
else | |
vhostsused="${vhostsused}M" | |
fi | |
echo "{\"${vhostspath}\":\"${vhostsused}\"}" |
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
const Alexa = require('alexa-sdk'); | |
// Define skill name | |
const SKILL_NAME = "Test Example"; | |
// Define translation settings | |
const languageStrings = { | |
'en': { | |
'translation': { | |
'WELCOME' : "Welcome to Gloucester Guide!" |
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
#!/bin/bash | |
prof='YOUR-AWS-CLI-PROFILE'; dist='CLOUDFRONT-DIST-ID'; items=100;for inv in $(aws --profile $prof cloudfront list-invalidations --distribution-id $dist --max-items $items | jq '.InvalidationList.Items[].Id' -r); do aws --profile $prof cloudfront get-invalidation --distribution-id $dist --id $inv; done |
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
#!/bin/bash | |
_ssl_confs=$(find /etc/nginx/conf.d -type f -name '*.conf'| grep -v backend | xargs grep -v '^#' | grep listen | awk '{print $1}' | sed 's/://g' | sort | uniq) | |
count=1 | |
echo '[{' | |
echo -n "\"CaptureTime\": \"$(date +%Y-%m-%dT%H:%M:%SZ)\"," | |
echo -n "\"TypeName\": \"Custom:NginxDomainList\"," | |
echo -n "\"SchemaVersion\": \"1.0\"," | |
echo -n "\"Content\": [" | |
for _ssl_conf in $_ssl_confs; do |
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
'use strict' | |
const aws = require('aws-sdk') | |
var ssm = new aws.SSM({apiVersion: '2014-11-06'}) | |
var params = { | |
InstanceId: 'YOUR_INSTANCE_ID', | |
TypeName: 'Custom:WPVersionsList' | |
} | |
ssm.listInventoryEntries(params, function (err, data) { | |
if (err) console.log(err, err.stack) // an error occurred | |
else console.log(data) // successful response |
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' | |
Description: | | |
WP VERSIONS | |
Resources: | |
GetAllWpVersion: | |
Type: "AWS::SSM::Document" | |
Properties: | |
DocumentType: "Command" | |
Content: |
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' | |
Description: | | |
SSM sample | |
Resources: | |
Docs: | |
Type: "AWS::SSM::Document" | |
Properties: | |
DocumentType: "Command" | |
Content: |
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' | |
Description: | | |
SSM sample | |
Resources: | |
Docs: | |
Type: "AWS::SSM::Document" | |
Properties: | |
DocumentType: "Command" | |
Content: |
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
#!/bin/bash | |
INSTANCEID=`/usr/bin/curl -s http://169.254.169.254/latest/meta-data/instance-id` | |
WPVERSION=`wp core version --path=/var/www/vhosts/${INSTANCEID}/` | |
TIME=`date '+%s' | awk '{print strftime("%Y-%m-%dT%H:%M:%SZ", $1)}'` | |
ITEMS=`jq -n \ | |
--arg wp_version ${WPVERSION} \ | |
--arg time ${TIME} \ | |
'[{"CaptureTime": $time,"TypeName": "Custom:WordPressInfo","Content":[{wp_version: $wp_version}], "SchemaVersion": "1.0"}]'` | |
aws ssm put-inventory \ | |
--instance-id "${INSTANCEID}" \ |