파일에서 aws access key와 secret key 추출
2022. 12. 14. 14:43ㆍAWS/AWS Command Line Interface
728x90
SMALL
- 개요
credentials 파일이나 특정 파일에서 aws access key 또는 aws secret key 추출 하는 방법
- 방법 (access key 추출)
cat ~/.aws/credentials | grep aws_access_key_id | awk '{print $3}'
cat ~/.aws/credentials | grep aws_access_key_id | awk -F = '{print $2}' | tr -d ' '
grep -RP '(?<![A-Z0-9])[A-Z0-9]{20}(?![A-Z0-9])' ~/.aws/credentials | awk '{print $3}'
- 방법 (secret key 추출)
cat ~/.aws/credentials | grep aws_secret_access_key | awk '{print $3}'
cat ~/.aws/credentials | grep aws_secret_access_key | awk -F = '{print $2}' | tr -d ' '
grep -RP '(?<![A-Za-z0-9/+=])[A-Za-z0-9/+=]{40}(?![A-Za-z0-9/+=])' ~/.aws/credentials | awk '{print $3}'
- reference
https://aws.amazon.com/blogs/security/a-safer-way-to-distribute-aws-credentials-to-ec2/
728x90
LIST
'AWS > AWS Command Line Interface' 카테고리의 다른 글
AWS CLI output table as multi columns (0) | 2023.10.10 |
---|---|
AWS CLI cheat sheet (0) | 2023.10.10 |
AWS Cli under ipv6 (0) | 2022.11.23 |
s3 파일 다운로드 없이 CLI로 간단히 보는 방법 (0) | 2022.10.12 |
aws cli error (An error occurred (AuthFailure) when calling the DescribeInstances operation: AWS was not able to validate the provided access credentials) (0) | 2022.10.06 |