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
#!/usr/bin/env bash | |
# minimum size to get benefit from AWS S3 intelligent tiering. | |
size=128000 | |
function help() { | |
echo "" | |
echo "Usage: s3-stats.sh (options)" | |
echo "" | |
echo " Get counts and percent of files over a given size." |
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
#!/usr/bin/env bash | |
# list empty buckets | |
buckets=$(aws s3api list-buckets| jq --raw-output '.Buckets[].Name') | |
for bucket in $buckets;do | |
files=$(aws s3 ls $bucket) | |
if [[ -z "$myVar" ]]; then | |
echo "$bucket" | |
fi | |
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
#!/usr/bin/env bash | |
help () { | |
echo " | |
Usage: | |
test/s3select.sh -v \\ | |
--bucket some-bucket \\ | |
--prefix foo/2020/10/20/20/57 \\ | |
--expression \"select * from s3object o where o.rawmsghostname = 'ynthtest-Oct20T20-filler-5b45a8d7'\" |
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
mongo --ssl \ | |
--host $(cat ~/infrastructure/keys/varsdb-creds | cut -d ':' -f2 | cut -d '@' -f2):27017 \ | |
--sslCAFile /opt/helix-tools/rds-combined-ca-bundle.pem \ | |
--username $(cat ~/infrastructure/keys/varsdb-creds | cut -d ':' -f1) \ | |
--password $(cat ~/infrastructure/keys/varsdb-creds | cut -d ':' -f2 | cut -d '@' -f1) |
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
#!/usr/bin/env node | |
'use strict'; | |
class Log { | |
constructor(options) { | |
options = options || {}; | |
this.level = 'off'; | |
this.levels = { | |
debug: 0, | |
info: 1, | |
warn: 2, |
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
#!/usr/bin/env node | |
'use strict'; | |
const AWS = require('aws-sdk'); | |
if (process.env.AWS_PROFILE) { // eslint-disable-line | |
AWS.config.credentials = new AWS.SharedIniFileCredentials({ | |
profile: process.env.AWS_PROFILE // eslint-disable-line | |
}); | |
AWS.config.logger = console; | |
} | |
const s3opts = {}; |
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
#!/usr/bin/env node | |
'use strict'; | |
const AWS = require('aws-sdk'); | |
if (process.env.AWS_PROFILE) { // eslint-disable-line | |
AWS.config.credentials = new AWS.SharedIniFileCredentials({ | |
profile: process.env.AWS_PROFILE // eslint-disable-line | |
}); | |
AWS.config.logger = console; | |
} | |
const s3opts = { apiVersion: '2006-03-01' }; |
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
#!/usr/bin/env node | |
'use strict'; | |
const AWS = require('aws-sdk'); | |
if (process.env.AWS_PROFILE) { // eslint-disable-line | |
AWS.config.credentials = new AWS.SharedIniFileCredentials({ | |
profile: process.env.AWS_PROFILE // eslint-disable-line | |
}); | |
AWS.config.logger = console; | |
} | |
const s3opts = { apiVersion: '2006-03-01' }; |
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
#!/usr/bin/env node | |
'use strict'; | |
const AWS = require('aws-sdk'); | |
if (process.env.AWS_PROFILE) { // eslint-disable-line | |
AWS.config.credentials = new AWS.SharedIniFileCredentials({ | |
profile: process.env.AWS_PROFILE // eslint-disable-line | |
}); | |
} | |
const s3opts = { apiVersion: '2006-03-01' }; | |
if (process.env.AWS_S3_ENDPOINT) { // eslint-disable-line |
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 AWS = require('aws-sdk') | |
if (process.env.AWS_PROFILE) { // eslint-disable-line | |
AWS.config.credentials = new AWS.SharedIniFileCredentials({ | |
profile: process.env.AWS_PROFILE // eslint-disable-line | |
}) | |
AWS.config.logger = console | |
} | |
const s3 = new AWS.S3({ apiVersion: '2006-03-01' }) | |
exports.handler = async(event, context) => { | |
const objects = await s3.listObjects(event).promise(); |
NewerOlder