Tech Blog

Software

AWS STS

By Hetvi Dadia2 min read
← Back to blog

AWS STS is a web service which stands for Security Token Service and it enables you to request temporary credentials for the AWS users. Using this, we can provide trusted users with temporary security credentials which can control access to our AWS resources.

How does it differ from the IAM user credentials?

The temporary credentials will work similar to credentials of the IAM users. The difference would be:

  1. They are short term – from a few minutes to some hours. 
  2. They are generated and provided dynamically whenever requested

How does it work on the application side?

Take the example of an application that is developed by an entity that owns AWS resources. The user/customer of this application needs to access these resources occasionally while using the app. In this case, instead of allowing the app to access the AWS resources permanently, it is more secure to make use of temporary credentials. This is where AWS STS comes into picture.

We can set up our application to use the AWS SDK which will make API calls to AWS STS endpoints for credentials. 

Please see the sample code below to see how to use AWS STS. The inputs are an accessKey and secretKey. The outputs are a set of temporary credentials containing an access key ID, a secret key and a security token.

Sample code:

The response for this would be similar to below:

Note: We need to set up an AWS IAM user first and using its Access Key ID and Secret Access Key, we need to fetch the temporary credentials.

Keep reading

You may be interested in

Browse all articles →
How Angular is Different from AngularJS
September 27, 20227 min read

How Angular is Different from AngularJS

What is Angular? Angular is a popular open-source Typescript framework and free to use. Considered to be a JavaScript-based framework,TypeScript.is its primary programming language. TypeScript is Developed by Microsoft and its superset of JavaScript, which simply means that TypeScript has all the capabilities that JS has and more additional features. Angular is majorly used for […]

By Sachin DevadigaRead More →
Angular constructor vs ngOnInit
September 15, 20223 min read

Angular constructor vs ngOnInit

Overview: If you are new to angular or have been working with it for a while, you will have questions like: Is it necessary to inject dependencies in the constructor and bind data? When should we use ngOnInit ? What is the difference between constructor and OnInit?. So, in this blog we will answer all […]

By Priyanka SRead More →
Angular – Difference between ng-container and ng-template
July 13, 20222 min read

Angular – Difference between ng-container and ng-template

Overview: ng-container and ng-template, both are angular elements which will work like containers with HTML elements, but with different purpose/use cases. Lets see what is the use of ng-container and ng-template below: ng-container: In some cases when you do not want to add an extra HTML element to the DOM , for example like div […]

By Priyanka SRead More →