WEBVTT

1
00:00:00.000 --> 00:00:01.658
<v Instructor>Now let's talk about a service that is</v>

2
00:00:01.658 --> 00:00:06.020
in the backbone of all the other AWS services.

3
00:00:06.020 --> 00:00:10.840
This is STS, and STS stands for Security Token Service.

4
00:00:10.840 --> 00:00:14.170
STS, as the name indicates, allows you to grant limited

5
00:00:14.170 --> 00:00:17.550
and temporary access to AWS resources.

6
00:00:17.550 --> 00:00:18.580
And they will issue a token,

7
00:00:18.580 --> 00:00:21.900
and that token will be temporary, valid up to one hour.

8
00:00:21.900 --> 00:00:23.760
So if you want to reuse that token,

9
00:00:23.760 --> 00:00:25.873
you must be refreshed, and so the credentials

10
00:00:25.873 --> 00:00:28.550
must be re-verified before you have a new token

11
00:00:28.550 --> 00:00:31.520
that allows you to access your AWS resources.

12
00:00:31.520 --> 00:00:33.680
So there's a bunch of API in STS,

13
00:00:33.680 --> 00:00:36.530
but one of the most important is going to be AssumeRole.

14
00:00:36.530 --> 00:00:39.120
So you can use the AssumeRole within your own account

15
00:00:39.120 --> 00:00:40.830
for enhanced security, for example you have your

16
00:00:40.830 --> 00:00:44.230
users assume a role that allows them to delete each

17
00:00:44.230 --> 00:00:46.220
to instances, so the reason we do this is that we want

18
00:00:46.220 --> 00:00:48.237
to have an extra layer of security,

19
00:00:48.237 --> 00:00:51.480
such as they don't accidentally delete each instances.

20
00:00:51.480 --> 00:00:54.660
They just have to assume a role first to do that.

21
00:00:54.660 --> 00:00:57.970
Or you can use AssumeRole for cross account access.

22
00:00:57.970 --> 00:01:01.130
And in that case, we assume a role in a target account,

23
00:01:01.130 --> 00:01:03.693
which is not our account, and because we have assumed

24
00:01:03.693 --> 00:01:05.543
a role there, we can perform actions

25
00:01:05.543 --> 00:01:07.863
on the resources of that account.

26
00:01:07.863 --> 00:01:09.447
There is also AssumeRole with SAML,

27
00:01:09.447 --> 00:01:11.610
and we will have a detail at it when we look at

28
00:01:11.610 --> 00:01:13.390
Identity Rederation, but this will be helpful

29
00:01:13.390 --> 00:01:16.092
to return credentials, when our users are federated

30
00:01:16.092 --> 00:01:17.830
through SAML.

31
00:01:17.830 --> 00:01:19.422
There is AssumeRole with WebIdentity,

32
00:01:19.422 --> 00:01:21.440
which is to return credentials for users that are

33
00:01:21.440 --> 00:01:23.350
going to be logged in through an identity provider

34
00:01:23.350 --> 00:01:25.670
such as Facebook Login, Google Login or any

35
00:01:25.670 --> 00:01:27.520
OIDC compatible login.

36
00:01:27.520 --> 00:01:29.930
And it's going to return as credentials,

37
00:01:29.930 --> 00:01:32.400
but AWS recommends against using this,

38
00:01:32.400 --> 00:01:33.450
and we'll see this again in the

39
00:01:33.450 --> 00:01:35.208
hands-on in the next lectures,

40
00:01:35.208 --> 00:01:37.320
and we have to use cognitive instead

41
00:01:37.320 --> 00:01:39.090
that is the most recommended way.

42
00:01:39.090 --> 00:01:41.280
And finally, there is GetSession Token,

43
00:01:41.280 --> 00:01:43.530
which is for multi-factor authentication,

44
00:01:43.530 --> 00:01:45.650
for user or AWS account root users.

45
00:01:45.650 --> 00:01:48.540
So anytime your users have MFA, they have to use

46
00:01:48.540 --> 00:01:51.850
GetSessionToken, to get a token allowing them access

47
00:01:51.850 --> 00:01:54.550
to the consol or through the CLI and stuff like this.

48
00:01:54.550 --> 00:01:57.620
So we can see STS is really at the center of providing

49
00:01:57.620 --> 00:02:02.020
our users our applications, tokens that allow them to

50
00:02:02.020 --> 00:02:04.100
talk to our AWS resources.

51
00:02:04.100 --> 00:02:06.950
So, let's look at the most common use case for STS,

52
00:02:06.950 --> 00:02:09.300
which is how to Assume a Role.

53
00:02:09.300 --> 00:02:11.300
So first, we define an IAM role; it could be within

54
00:02:11.300 --> 00:02:13.030
your account or a cross-account,

55
00:02:13.030 --> 00:02:15.220
and we'll just have a look at it in this account.

56
00:02:15.220 --> 00:02:17.820
Then you define which principles can access this IAM role,

57
00:02:17.820 --> 00:02:21.540
so which users, which other roles can access this IAM role,

58
00:02:21.540 --> 00:02:24.920
and then you use the STS service to retrieve controls

59
00:02:24.920 --> 00:02:26.210
and impersonate the IAM role,

60
00:02:26.210 --> 00:02:29.250
and this is using the AssumeRole API as we just discussed.

61
00:02:29.250 --> 00:02:31.290
And then the credentials will be valid for between

62
00:02:31.290 --> 00:02:33.120
15 minutes to one hour based on how you

63
00:02:33.120 --> 00:02:35.050
configure your AssumeRole API.

64
00:02:35.050 --> 00:02:37.630
So we have the user, and it wants to assume a role within

65
00:02:37.630 --> 00:02:39.340
the same or another accounts,

66
00:02:39.340 --> 00:02:41.130
so it's going to say "Okay, I want to assume that role,"

67
00:02:41.130 --> 00:02:43.960
so I'm going to use that AssumeRole API, okay,

68
00:02:43.960 --> 00:02:45.580
and invoke STS.

69
00:02:45.580 --> 00:02:47.223
STS is going to check with IAM

70
00:02:47.223 --> 00:02:49.530
if we have the permissions to do so,

71
00:02:49.530 --> 00:02:51.730
then it will return us temporary credentials,

72
00:02:51.730 --> 00:02:54.070
and these credentials can be used to access

73
00:02:54.070 --> 00:02:55.780
that role in our account.

74
00:02:55.780 --> 00:02:56.810
So we can see the whole process,

75
00:02:56.810 --> 00:02:59.430
we first ask stuff from STS who checks with IAM,

76
00:02:59.430 --> 00:03:00.890
returns us security credentials,

77
00:03:00.890 --> 00:03:04.840
and then we are able to assume that role and endorse it.

78
00:03:04.840 --> 00:03:06.710
This is very very similar when you have cross

79
00:03:06.710 --> 00:03:09.930
account access, so this is a low quality diagram

80
00:03:09.930 --> 00:03:12.550
from the website of STS but I think it is clear enough.

81
00:03:12.550 --> 00:03:14.520
So we have a production account on the left hand side,

82
00:03:14.520 --> 00:03:16.090
and a development account on the right hand side.

83
00:03:16.090 --> 00:03:18.650
And as we can see, the first thing to do is that the admin

84
00:03:18.650 --> 00:03:21.780
will create a role in the production account.

85
00:03:21.780 --> 00:03:24.060
Then the admin in the development account will create a

86
00:03:24.060 --> 00:03:27.200
developer's group with the permission to access

87
00:03:27.200 --> 00:03:29.070
this UpdateApp role.

88
00:03:29.070 --> 00:03:31.480
Then the user will request access to the role.

89
00:03:31.480 --> 00:03:33.080
STS will return the role credentials,

90
00:03:33.080 --> 00:03:35.260
so now we have the credentials to use that role

91
00:03:35.260 --> 00:03:37.670
in this account, and then the user using these new

92
00:03:37.670 --> 00:03:39.810
credentials can access, for example,

93
00:03:39.810 --> 00:03:42.030
an extra bucket in the other account.

94
00:03:42.030 --> 00:03:44.280
So this is a process for cross account access

95
00:03:44.280 --> 00:03:47.410
and this is done using STS so you never share credentials

96
00:03:47.410 --> 00:03:49.080
across accounts, you never ever do that,

97
00:03:49.080 --> 00:03:51.720
like create a new user and send the credentials, no.

98
00:03:51.720 --> 00:03:54.190
You create a role, and you make sure that your user

99
00:03:54.190 --> 00:03:56.790
assume that role, and STS will return to you,

100
00:03:56.790 --> 00:03:58.960
role credentials that are temporary so even if you

101
00:03:58.960 --> 00:04:01.880
somehow lose them, then it is not as bad as

102
00:04:01.880 --> 00:04:03.960
leaking entire credentials of an account.

103
00:04:03.960 --> 00:04:04.793
Okay?

104
00:04:04.793 --> 00:04:06.418
So remember, any time in the exam you see,

105
00:04:06.418 --> 00:04:10.990
cross account access you see, AssumingRoles think STS.

106
00:04:10.990 --> 00:04:11.823
Okay?

107
00:04:11.823 --> 00:04:13.480
Well that's it for STS, I will see you in the next

108
00:04:13.480 --> 00:04:15.653
lecture for some more Identity Federation.

