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 route53domains list-domains \ | |
--query 'Domains[?ends_with(DomainName, `.com.au`)].{DomainName:DomainName}' \ | |
--output text \ | |
--profile us-east-1 |
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 cloudformation describe-stacks \ | |
--stack-name <STACK_NAME> \ | |
--query 'Stacks[].Parameters[].{Key:ParameterKey,Value:ParameterValue}' \ | |
--output table |
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 | |
instance_id=$(curl -s 169.254.169.254/latest/meta-data/instance-id) | |
name=$(aws ec2 describe-tags \ | |
--filters \ | |
"Name=resource-type,Values=instance" \ | |
"Name=resource-id,Values=$instance_id" \ | |
"Name=key,Values=Name" \ | |
--query "Tags[].Value" \ | |
--output text) | |
echo "$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
aws ec2 describe-instances \ | |
--query 'Reservations[].Instances[].[Tags[?Key==`Customer`]|[0].Value,Tags[?Key==`Name`]|[0].Value,InstanceId,InstanceType]' \ | |
--output text |
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 s3 cp s3://BUCKET_NAME/PREFIX/ s3://BUCKET_NAME/PREFIX/ \ | |
--metadata-directive 'REPLACE' \ | |
--content-type 'image/png' \ | |
--cache-control 'public, max-age=2592000, immutable' \ | |
--recursive \ | |
--exclude '*' \ | |
--include '*.png' |
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 rds describe-db-snapshots \ | |
--no-include-shared \ | |
--no-include-public \ | |
--query 'DBSnapshots[?SnapshotType!=`automated`].[ | |
SnapshotType, | |
DBSnapshotIdentifier, | |
DBInstanceIdentifier, | |
SnapshotCreateTime, | |
Engine, | |
EngineVersion, |
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 | |
# | |
# https://aws.amazon.com/premiumsupport/knowledge-center/authenticate-mfa-cli/ | |
# | |
# Usage: source ~/bin/awssessiontoken | |
# arn:aws:iam::12345689012:mfa/ExampleMFADevice | |
mfa_arn=$(aws iam list-mfa-devices --query 'MFADevices[].SerialNumber' --output text) | |
echo "MFA ARN: $mfa_arn" | |
echo -n "Enter MFA Code: " |
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
-- [SQL Queries, Functions, and Operators](https://docs.aws.amazon.com/athena/latest/ug/functions-operators-reference-section.html) | |
SELECT | |
from_iso8601_timestamp(time) as new_time, | |
date_format(from_iso8601_timestamp(time), '%Y') AS year, | |
hour(from_iso8601_timestamp(time)) AS hour, | |
from_iso8601_timestamp(time) at time zone 'Pacific/Auckland' as nzst_time, | |
hour(from_iso8601_timestamp(time) at time zone 'Pacific/Auckland') AS nzst_hour, | |
minute(from_iso8601_timestamp(time) at time zone 'Pacific/Auckland') AS nzst_minute, | |
* |
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 cloudformation list-stacks --query 'StackSummaries[?starts_with(StackName, `production`)].{StackName:StackName,StackStatus:StackStatus} | sort_by(@, &StackName)' |
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 s3api list-objects --bucket A_BUCKET --prefix A_PREFIX --query 'Contents[?LastModified>=`2012-03-04`][].{Key: Key, Size: Size, LastModified: LastModified}' |