Skip to content

Instantly share code, notes, and snippets.

View hideokamoto's full-sized avatar

Hidetaka Okamoto hideokamoto

View GitHub Profile
@hideokamoto
hideokamoto / file0.txt
Created December 18, 2017 07:10
VCCW(Version3)にAWS-CLIをインストールする ref: https://qiita.com/motchi0214/items/f136e1c97a4e61321a83
$ 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
#!/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}\"}"
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!"
#!/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
#!/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
'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
---
AWSTemplateFormatVersion: '2010-09-09'
Description: |
WP VERSIONS
Resources:
GetAllWpVersion:
Type: "AWS::SSM::Document"
Properties:
DocumentType: "Command"
Content:
---
AWSTemplateFormatVersion: '2010-09-09'
Description: |
SSM sample
Resources:
Docs:
Type: "AWS::SSM::Document"
Properties:
DocumentType: "Command"
Content:
---
AWSTemplateFormatVersion: '2010-09-09'
Description: |
SSM sample
Resources:
Docs:
Type: "AWS::SSM::Document"
Properties:
DocumentType: "Command"
Content:
#!/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}" \