1
00:00:00,000 --> 00:00:02,701
<v Narrator>So we have our API right here and</v>

2
00:00:02,701 --> 00:00:07,701
for now it has two GETs and there is one little resource

3
00:00:07,899 --> 00:00:09,583
right here and so what we want to do

4
00:00:09,583 --> 00:00:12,250
is deploy this API to my stages.

5
00:00:13,257 --> 00:00:17,588
So let's go back to resources and will do Action deploy API.

6
00:00:17,588 --> 00:00:19,856
Now when we deploy an API, we have to choose a stage

7
00:00:19,856 --> 00:00:21,314
and currently we don't have any stages

8
00:00:21,314 --> 00:00:23,111
so we'll choose a new stage.

9
00:00:23,111 --> 00:00:26,032
This stage name is going to be, for example DEV,

10
00:00:26,032 --> 00:00:29,006
and stage description dev stage.

11
00:00:29,006 --> 00:00:30,631
I'll just have it lower case.

12
00:00:30,631 --> 00:00:33,047
Okay, and deployment description will say:

13
00:00:33,047 --> 00:00:35,047
first deployment to dev.

14
00:00:36,881 --> 00:00:38,994
Here we go, we deploy our code.

15
00:00:38,994 --> 00:00:43,755
So now our code is now in stage and so our whole API

16
00:00:43,755 --> 00:00:47,721
is under this DEV little boat right here; and so we can see

17
00:00:47,721 --> 00:00:50,362
the exact same resources as we had from before,

18
00:00:50,362 --> 00:00:52,585
except this time we have an URL

19
00:00:52,585 --> 00:00:55,746
that we can use to invoke our stage.

20
00:00:55,746 --> 00:00:58,554
So let's click on it and as we can see now,

21
00:00:58,554 --> 00:01:03,129
using this URL /DEV because we are in the DEV stage,

22
00:01:03,129 --> 00:01:05,825
we have a response from a Lambdai function,

23
00:01:05,825 --> 00:01:09,515
statusCode 200, body Hello from Lambdai.

24
00:01:09,515 --> 00:01:13,104
Amazing but what if we go to /houses,

25
00:01:13,104 --> 00:01:15,096
then we get a different response

26
00:01:15,096 --> 00:01:18,015
status 200, body we have beautiful houses.

27
00:01:18,015 --> 00:01:21,989
So we have built and deployed a API already, a rest API.

28
00:01:21,989 --> 00:01:25,484
That doesn't seem like much but we actually did a lot

29
00:01:25,484 --> 00:01:27,305
and all of this is server-less.

30
00:01:27,305 --> 00:01:28,896
My Lambdai functions are being invoked

31
00:01:28,896 --> 00:01:31,531
as I go to different path.

32
00:01:31,531 --> 00:01:34,799
Now in this deployment stage, as you can see,

33
00:01:34,799 --> 00:01:37,288
we have a lot of different options.

34
00:01:37,288 --> 00:01:39,640
So we will not go over all of them,

35
00:01:39,640 --> 00:01:43,049
but you can have a cache, you can throttle some methods,

36
00:01:43,049 --> 00:01:44,260
we'll see this later on.

37
00:01:44,260 --> 00:01:46,374
We can enable logs and tracing,

38
00:01:46,374 --> 00:01:48,479
so we can have CloudWatch logs, etc.

39
00:01:48,479 --> 00:01:51,278
Stage variables is what I have been hammering you with,

40
00:01:51,278 --> 00:01:53,119
so here we can say add a stage variable.

41
00:01:53,119 --> 00:01:56,490
Alias for example, and add the value being dev.

42
00:01:56,490 --> 00:01:58,861
So we know that if we use this alias variable

43
00:01:58,861 --> 00:02:02,560
in our resources now we'll be able to have

44
00:02:02,560 --> 00:02:05,130
like decisions and point it to the right lender function

45
00:02:05,130 --> 00:02:06,997
and this is just an example to illustrate.

46
00:02:06,997 --> 00:02:11,900
We could generate an SDK for Android, JavaScript, IOS, etc.

47
00:02:11,900 --> 00:02:16,428
We could export our API as Swagger and so on,

48
00:02:16,428 --> 00:02:18,914
or Postman Extension, or API Gateway Extension,

49
00:02:18,914 --> 00:02:20,269
so we have a lot of different options

50
00:02:20,269 --> 00:02:22,358
and we can use Swagger Open API3.

51
00:02:22,358 --> 00:02:24,062
We can get a history of the deployments,

52
00:02:24,062 --> 00:02:27,731
so as we change the resources back there

53
00:02:27,731 --> 00:02:30,779
and re-devoid to the stage dev then we'll get an idea

54
00:02:30,779 --> 00:02:32,259
of all the deployments that happen

55
00:02:32,259 --> 00:02:34,330
and we can roll back at any time

56
00:02:34,330 --> 00:02:36,274
to an earlier deployment if something went wrong.

57
00:02:36,274 --> 00:02:38,220
Documentation history if we wanted to provide

58
00:02:38,220 --> 00:02:40,597
documentation for API and Canary

59
00:02:40,597 --> 00:02:43,541
to do this testing I told you about.

60
00:02:43,541 --> 00:02:46,139
When we have, for example, 95% of our traffic

61
00:02:46,139 --> 00:02:48,744
going to one API version and the other one

62
00:02:48,744 --> 00:02:52,880
5% to go to the other API version and you can control this.

63
00:02:52,880 --> 00:02:54,401
Obviously, if you go to your resources

64
00:02:54,401 --> 00:02:57,089
you could deploy your API one more time

65
00:02:57,089 --> 00:02:58,638
and we could create a new stage

66
00:02:58,638 --> 00:03:02,830
and call this stage prod and this is prod API

67
00:03:02,830 --> 00:03:07,098
and here deployment to prod whatever I want to say it

68
00:03:07,098 --> 00:03:09,434
and I deploy and now we have two stages

69
00:03:09,434 --> 00:03:12,359
and our production API can be invoked using this URL.

70
00:03:12,359 --> 00:03:15,185
As we can see can get the same results as before

71
00:03:15,185 --> 00:03:16,810
because we deployed the exact same API

72
00:03:16,810 --> 00:03:18,984
but now we have the /prod, so we can go

73
00:03:18,984 --> 00:03:23,139
to /prod/houses and get another response.

74
00:03:23,139 --> 00:03:25,827
So this is it for our API, here we have deployed two stages

75
00:03:25,827 --> 00:03:29,500
and we could really expand with Stage Variables

76
00:03:29,500 --> 00:03:32,857
if we wanted to but for now we'll just have conceptually

77
00:03:32,857 --> 00:03:34,013
the understanding that Stage Variables will allow us

78
00:03:34,013 --> 00:03:37,486
to marginalize our deployment and customize

79
00:03:37,486 --> 00:03:39,714
what our API gateway does.

80
00:03:39,714 --> 00:03:43,005
So that's it for this lecture, I hope you liked it,

81
00:03:43,005 --> 00:03:45,349
I hope that stages make sense now

82
00:03:45,349 --> 00:03:47,503
and I will see you in the next lecture.

