Myron's Dev Notes


AWS Notes

AWS Credentials

export AWS_SHARED_CREDENTIALS_FILE=...
aws --profile xxx

CLI Tools

pip install awscli
pip install aws-shell
pip install awslogs
pip install apilogs

S3 config

# ~/.aws/config
[default]
region = us-west-2
s3 =
  max_concurrent_requests = 20
  max_queue_size = 10000
  multipart_threshold = 1GB
  multipart_chunksize = 1GB

S3 bucket policies

aws --profile myprod s3api get-bucket-policy --bucket bname |jq '.Policy | fromjson'

S3 list sorted

# All files sorted
aws s3 ls --human-readable --recursive s3://bname/|sort|tee s3-files.sorted

Pull all CloudWatch logs

for g in $(awslogs groups |grep interest); do 
  echo '-------'
  echo $g
  awslogs get $g ALL -s6h

done|tee 2019-04-02-my.logs

List hosted zones

aws --profile myprod route53 list-hosted-zones |jq -c '.HostedZones[]|{name:.Name,id:.Id}'

Get Account ID

Retrieving Instance Metadata

UserData

cd /var/lib/cloud/instances/i-xxx/user-data.txt

# logs
less /var/log/cloud-init.log
journalctl -xu cloud-final -f

EKS

aws-iam-authenicator

aws eks get-token --cluster-name xxx


# get kubeconfig
aws --region us-west-2 eks update-kubeconfig --name clustername