- vừa được xem lúc

AWS Certified Solutions Architect Professional - Identity & Federation - STS to Assume a Role

0 0 6

Người đăng: Quân Huỳnh

Theo Viblo Asia

Introduction

Quick note about STS you should know for a example.

STS

AWS Security Token Service (AWS STS) is the service that is so important in AWS, it allow IAM user or federated users access your AWS service by request temporary credentials.

AWS STS is a web service that you can call via API to get temporary credentials, and then use them explicitly to make calls to AWS services.

image.png

Benifit for using temporary credentials

You do not have to distribute or embed long-term AWS security credentials with an application.

You can provide access to your AWS resources to users without having to define an AWS identity for them.

The temporary security credentials have a limited lifetime, after temporary security credentials expire, they cannot be reused, the user can request new credentials.

AWS STS and AWS regions

AWS STS is a global service that has a default endpoint at https://sts.amazonaws.com, but you can use Regional AWS STS endpoints instead of the global endpoint to reduce latency, for example https://sts.us-west-2.amazonaws.com.

Use STS to get temporary credentials

First, we define IAM role within your account or cross-accounts that we want to assume role.

image.png

Then we define which principles can access this IAM role. For example, this rule only allow lambda and edgelambda to assume role.

{ "Version" : "2012-10-17", "Statement" : [ { "Effect" : "Allow", "Principal" : { "Service" : [ "edgelambda.amazonaws.com", "lambda.amazonaws.com", ] }, "Action" : "sts:AssumeRole", } ]
}

Then use AWS STS API to retrieve credential via AssumeRole API. For examples session policy passed with AssumeRole API call.

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "s3:ListBucket", "Resource": "*" } ]
}

And then lamda will retrieve temporary credentials that can list all S3 bucket in your AWS resources. Temporary cerdentials can be valid between 15 minutes to 12 hour.

image.png

Situation use STS

Provide access for an IAM user in one AWS account to access resource in another account that you own both.

Provide access for an IAM user in AWS account owned by 3rd parties.

Provide access for AWS service to other AWS resources.

Provide access for externally authenticated users (identity federation).

Provide access for an IAM user in one AWS account to access resource in another account that you own both

Example we want account A can have permission to terminate EC2 instance in account B.

image.png

First we define role in account B, then we define which principles can access this IAM role is account A, then account A call STS API to retrieve temporary credential for terminate EC2 instance in account B.

Provide access for an IAM user in AWS account owned by 3rd parties.

When third parties require access to your organization's AWS resources, you can use roles to delegate access to them, you can grant these third parties access to your AWS resources without sharing your AWS security credentials.

Third parties must provide the following information for you:

  • The third party's AWS account ID, we specify their AWS account ID as the principal when you define the trust policy for the role.
  • An external ID to uniquely associate with the role. The external ID can be any secret identifier that is known by you and the third party.
  • The permissions that the third party requires to work with your AWS resources.

For example.

{ "Version": "2012-10-17", "Statement": { "Effect": "Allow", "Principal": { "AWS": "Example Corp's AWS Account ID" }, "Action": "sts:AssumeRole", "Condition": { "StringEquals": { "sts:ExternalId": "12345" } } }
}

Please read about The confused deputy problem.

STS important APIs

  1. AssumeRole API: access a role within your account or cross-account.
  2. AssumeRoleWithSAML: return temporary credentials for users logged with SAML.
  3. AssumeRoleWithWebIdentity: return temporary credentials for users logged in a mobile or web application with a web identity provider.
  4. GetSessionToken: for MFA from a user or AWS account root user.
  5. GetFederationToken: returns temporary credentials for a federated user, usually a proxy application that gets temporary security credentials on behalf of distributed applications inside a corporate network.

End

End note about STS.

Bình luận

Bài viết tương tự

- vừa được xem lúc

PDF Export, cẩn thận với những input có thể truyền vào

Giới thiệu. Dạo gần đây mình tình cờ gặp rất nhiều lỗi XSS, tuy nhiên trang đó lại có sử dụng dữ liệu người dùng input vào để export ra PDF.

0 0 49

- vừa được xem lúc

Giới thiệu về AWS Batch

Khi sử dụng hệ thống cloud service, điều chúng ta thường phải quan tâm đến không chỉ là hiệu suất hoạt động (performance) mà còn phải chú ý đến cả chi phí bỏ ra để duy trì hoạt động của hệ thống. Chắn hẳn là hệ thống lớn hay nhỏ nào cũng đã từng phải dùng đến những instance chuyên để chạy batch thực

0 0 128

- vừa được xem lúc

Tìm hiểu về AWS KMS

1. AWS KMS là gì. Ở KMS bạn có thể lựa chọn tạo symetric key (khóa đối xứng) hoặc asymetric key (khóa bất đối xứng) để làm CMK (Customer Master Key). Sau khi tạo key thì có thể thiết đặt key policy để control quyền access và sử dụng key.

0 0 53

- vừa được xem lúc

AWS VPC cho người mới bắt đầu

Tuần này, tôi trình bày lại những gì tôi đã học được về Virtual Private Cloud (VPC) của Amazon. Nếu bạn muốn xem những gì tôi đã học được về AWS, hãy xem Tổng quan về DynamoDB và Tổng quan về S3. VPC là gì. Những điều cần lưu ý:.

0 0 69

- vừa được xem lúc

AWS Essentials (Phần 6): Guildline SNS Basic trên AWS

Tiếp tục với chuỗi bài viết về Basic AWS Setting, chúng ta tiếp tục tìm hiểu tiếp tới SNS (Simple Notification Service). Đây là một service của AWS cho phép người dùng setting thực hiện gửi email, text message hay push notification tự động tới mobile device dựa trên event người dùng setting phía AWS

0 0 125

- vừa được xem lúc

Sử dụng Amazon CloudFront Content Delivery Network với Private S3 Bucket — Signing URLs

Trong nhiều trường hợp, thì việc sử dụng CDN là bắt buộc. Mình đã trải nghiệm với một số CDN nhưng cuối cùng mình lựa chọn sử dụng AWS CloudFront.

0 0 105