aws lightsail get-blueprints --query 'blueprints[?group==`nginx`]'
[
{
"blueprintId": "nginx_1_12_0_2",
"name": "Nginx",
"group": "nginx",
"type": "app",| #!/bin/bash | |
| # | |
| # Replace spaces with @'s | |
| # Replace @'s in BEGIN with spaces | |
| # Replace @'s in END with spaces | |
| # Replace @'s with newlines | |
| sed -i '' -e 's/ /@/g | |
| s/-----BEGIN@RSA@PRIVATE@KEY-----/-----BEGIN RSA PRIVATE KEY-----/ | |
| s/-----END@RSA@PRIVATE@KEY-----/-----END RSA PRIVATE KEY-----/ | |
| s/@/\'$'\n/g' $1 |
Get load balancer ARN
arn=$(aws elbv2 describe-load-balancers --names <value> --query 'LoadBalancers[].[LoadBalancerArn]' --output text)
Get listeners
aws elbv2 describe-listeners --load-balancer-arn "$arn" --query 'Listeners[].{ListenerArn:ListenerArn,Protocol:Protocol,Port:Port}'
[
| aws s3api list-objects --bucket A_BUCKET --prefix A_PREFIX --query 'Contents[?LastModified>=`2012-03-04`][].{Key: Key, Size: Size, LastModified: LastModified}' |
| aws cloudformation list-stacks --query 'StackSummaries[?starts_with(StackName, `production`)].{StackName:StackName,StackStatus:StackStatus} | sort_by(@, &StackName)' |
| -- [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, | |
| * |
| #!/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: " |
| aws rds describe-db-snapshots \ | |
| --no-include-shared \ | |
| --no-include-public \ | |
| --query 'DBSnapshots[?SnapshotType!=`automated`].[ | |
| SnapshotType, | |
| DBSnapshotIdentifier, | |
| DBInstanceIdentifier, | |
| SnapshotCreateTime, | |
| Engine, | |
| EngineVersion, |
| 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' |
| aws ec2 describe-instances \ | |
| --query 'Reservations[].Instances[].[Tags[?Key==`Customer`]|[0].Value,Tags[?Key==`Name`]|[0].Value,InstanceId,InstanceType]' \ | |
| --output text |