Administrator
发布于 2024-08-21 / 11 阅读
0

AWS EC服务器获取AK/SK

curl -s -f -H "X-aws-ec2-metadata-token:AQAEAAIlAL3PrSdAvVN6IaeSEYmxPBm0e6hmbe59RKClxgOXnaQaaw==" http://169.254.169.254/latest/meta-data/identity-credentials/ec2/security-credentials/ec2-instance

获取aws token:

curl --connect-timeout 2 -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600" 2>/dev/null || wget --timeout 2 --tries 1 -q -O - --method PUT "http://169.254.169.254/latest/api/token" --header "X-aws-ec2-metadata-token-ttl-seconds: 21600" 2>/dev/null

HEADER="X-aws-ec2-metadata-token:AQAEAAIlAL3PrSdAvVN6IaeSEYmxPBm0e6hmbe59RKClxgOXnaQaaw==”

URL="http://169.254.169.254/latest/meta-data"

curl-s-f -H "X-aws-ec2-metadata-token:AQAEAAIlAL3PrSdAvVN6IaeSEYmxPBm0e6hmbe59RKClxgOXnaQaaw==”

http://169.254.169.254/latest/meta-data/identity-credentials/ec2/security-credentials/ec2-instance