AWS - STS Security Token Service
AWS
Security Token Service (STS) that enables you to request temporary, limited
privilege credentials for IAM Users or Federated Users).
AWS STS has these specific properties when assigning temporary access.
· It can range from a few minutes to a few hours.
· Once the AWS STS provided temporary token expires, it cannot be reused at any point.
· You can invoke AWS STS only through AWS SDKs or AWS CLIs.
Let's see with an example. We are going to create a user and set up to access the S3 bucket using STS.
I created a user called "s3demouser" with no permission attached to it.
Created an S3 bucket with NO policy attached to it.
Let's create a policy that provides S3 Read Only Access - The policy name is s3-readonly.
Now, Create an IAM role called "user-trust-policy-role".
This role should contain 2 items:
1) Trust Relationship to allow "s3demouser" to assume STS role.
2) Attach the s3-readonly to the user-trust-policy-role.
aws sts assume-role --role-arn "user-trust-policy-role"" --role-session-name demo-session --duration-seconds 300
1) Acces Key.
2) Secret Key.
3) Session Token.
Export them as below:
export
AWS_ACCESS_KEY_ID="ASIAX2SCLS3KP4MZOU2W"
export
AWS_SECRET_ACCESS_KEY="5/3gmTi7yhk17CJsm0j8N5OTr1rX2eAxP7fw59CY"
export
AWS_SESSION_TOKEN="IQoJb3J”
You are all set.
Comments
Post a Comment