Skip to content

It shows how to generate and use temporary security credential using AWS STS.

Notifications You must be signed in to change notification settings

kyopark2014/aws-security-token-service

Repository files navigation

AWS STS를 이용한 Temporary security credential 활용하기

Lambda의 Function URL와 같이 IAM을 이용하여 REST api를 호출할때는 보안상 Temporary security credential를 고려해 볼 수 있습니다. 여기에서는 AWS CLI 또는 Amazon Lambda를 이용해 STS(Security Token Server)로 부터 Temporary security credential을 생성하여 Lambda Function URL을 호출할때 사용하고, Crypto와 AWS SDK를 이용해 REST API로 S3를 호출하는 예제를 제공합니다.

Temporary security credential

AWS Security Token Service (AWS STS) creates and provides trusted users with temporary security credentials that can control access to your AWS resources. Temporary security credentials work almost identically to the long-term access key credentials that your IAM users can use, with the following differences:

Temporary security credentials are short-term, as the name implies. They can be configured to last for anywhere from a few minutes to several hours. After the credentials expire, AWS no longer recognizes them or allows any kind of access from API requests made with them.

Temporary security credentials are not stored with the user but are generated dynamically and provided to the user when requested. When (or even before) the temporary security credentials expire, the user can request new credentials, as long as the user requesting them still has permissions to do so.

AWS CLI를 이용한 Temporary security credential 생성하기

AWS CLI를 이용한 temporary secruity credential에서는 AWS CLI를 이용한 temporary security credential을 생성하는 방법을 설명합니다.

Lambda 를 이용하여 Temporary security credential 생성하기

lambda-for-sts에서는 lambda를 이용하여 STS에 접속해, temporary security credential를 얻어오는 과정을 설명합니다.

Temporary security credential로 Lambda Function URL 호출하기

Temporary Security credential 을 이용하여 Lambda Function URL 접속에 따라 Lambda Function URL로 Temporary security credential을 이용해 API를 호출 할 수 있습니다.

AWS REST API Authentication

Lambda에서 Crypto 이용하여 S3 파일 리스트 확인

Crypto를 이용한 AWS REST API Authentication와 같이 Signing AWS requests with Signature Version 4을 이용하여 S3에 저장된 파일 정보를 읽어 올 수 있습니다.

Lambda에서 AWS SDK를 이용하여 S3 파일 리스트 확인

AWS SDK를 이용한 AWS REST API Authentification와 같이 AWS SDK를 이용하여 S3에 저장된 파일정보를 읽어 올 수 있습니다. Lambda는 Temporary security credential을 Environment variable로 사용하므로 별도 구현없이 AWS SDK 안전하게 REST API를 호출 할 수 있습니다.

Node.JS Client에서 Temporary security credential를 이용하여 S3 파일 리스트 확인

Node.JS로 된 독립된 Client가 Temporary security credential을 이용하여 S3에 있는 파일 리스트를 확인 합니다.

Node.JS Client에서 Temporary security credential를 이용하여 Lambda Function URL에 요청

Node.JS로 된 독립된 Client가 Temporary security credential을 이용하여 Lambda Funtion URL에 접속을 요청하고 응답을 확인 할 수 있습니다.

Lambda Functional URL은 AWS CDK를 이용한 구현 및 Temporary security credetion을 이용한 client 이용해 DynamodB애 데이터를 저장하고 읽어오는 실제적인 예를 보여줍니다.

Reference

Temporary security credentials in IAM

About

It shows how to generate and use temporary security credential using AWS STS.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published