Bike Path
Saturday, April 1, 2023
Friday, November 4, 2022
PostgreSQL: Store result in a CSV file
\copy (your query) to 'file path' csv header;
Example
\copy (select * from versions where item_type = 'User'%) to '/home/my_sql_query_result.csv' csv header;
AWS Config - Disable recording mode
ACCOUNT_ID="123456789"
CMD="aws sts assume-role --role-arn arn:aws:iam::${ACCOUNT_ID}:role/AWSControlTowerExecution --role-session-name AWSCLI-Session"
OUTPUT=$(bash -c "${CMD}")
export AWS_ACCESS_KEY_ID=`echo ${OUTPUT} | jq -r '.Credentials .AccessKeyId'`
export AWS_SECRET_ACCESS_KEY=`echo ${OUTPUT} | jq -r '.Credentials .SecretAccessKey'`
export AWS_SESSION_TOKEN=`echo ${OUTPUT} | jq -r '.Credentials .SessionToken'`
aws configservice stop-configuration-recorder --configuration-recorder-name aws-controltower-BaselineConfigRecorder --region us-east-1
aws configservice stop-configuration-recorder --configuration-recorder-name aws-controltower-BaselineConfigRecorder --region us-east-2
Go language journey
package main