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
APP_ID=$(aws amplify list-apps --query 'apps[? ! contains(keys(@), `productionBranch`) == `true`].[appId]' --output text ) | |
echo $APP_ID | while read appid | |
do | |
aws amplify delete-app --app-id $appid | |
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
aws ec2 get-console-screenshot --instance-id ID --query "ImageData" --output text > f; cat f | base64 -D > screen.jpg |
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
import json, boto | |
# Connect to IAM with boto | |
iam = boto.connect_iam(ACCESS_KEY, SECRET_KEY) | |
# Create user | |
user_response = iam.create_user('aws-user') | |
# Create Policy | |
policy = { 'Version' : '2012-10-17'} |
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
for NAME in $(aws logs describe-log-groups | jq -r .logGroups[].logGroupName | grep amplifynotes) | |
do | |
aws logs delete-log-group --log-group-name $NAME | |
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
import boto3 | |
s3 = boto3.resource('s3') | |
for bucket in s3.buckets.all(): | |
print(bucket.name) |
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
{ | |
"demo-global-table": [ | |
{ | |
"PutRequest": { | |
"Item": { | |
"id": {"S": "0123456789"}, | |
"firstname": {"S": "Jeff"}, | |
"lastname": {"S": "Barr"} | |
} | |
} |
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
import logging | |
import boto3 | |
from botocore.exceptions import ClientError | |
def upload_file(file_name, bucket, object_name=None): | |
"""Upload a file to an S3 bucket | |
:param file_name: File to upload | |
:param bucket: Bucket to upload to | |
:param object_name: S3 object name. If not specified then file_name is used |
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 iptables -A OUTPUT -m owner ! --uid-owner root -d 169.254.169.254 -j DROP |
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
function updatePlayCount(your_object) { | |
return new Promise((resolve, reject) => { | |
const LAST_PLAYED_TIME = Math.round(new Date() / 1000); | |
var params = { | |
TableName: "your_table", | |
Key: { | |
"cognitoid": your_object.userId, |
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
async function asyncWorker() { | |
return new Promise( (resolve, reject) => { | |
setTimeout(resolve, 2000); | |
}); | |
} | |
async function main() { | |
console.debug('Started'); |