1
00:00:00,760 --> 00:00:05,840
In the last section we added in a tremendous amount of configuration to our travel start YAML file.

2
00:00:05,840 --> 00:00:12,050
Now last thing we have to add in here is a set of API keys that are going to give access to our account

3
00:00:12,260 --> 00:00:14,420
over to Travis s.i.

4
00:00:14,420 --> 00:00:19,990
The last thing we do is generate that set of API keys and then enter them into this travesty YAML script.

5
00:00:20,330 --> 00:00:21,730
So let's get to it.

6
00:00:21,770 --> 00:00:26,190
I'm going to first get started by opening up my AWOS console again.

7
00:00:26,200 --> 00:00:32,240
I'll then find the services tab at the top and I'm going to search for I am I am.

8
00:00:32,240 --> 00:00:37,310
Is this service that is used to manage API keys that can be used by outside services.

9
00:00:38,520 --> 00:00:39,530
On the left hand side.

10
00:00:39,640 --> 00:00:40,870
Ms Neumann here.

11
00:00:41,760 --> 00:00:46,920
We're going to find the section of users because we're essentially going to get generate a new user

12
00:00:47,190 --> 00:00:55,620
that is going to be used by Travis s.i then at the top of fine add user and then I'll provide a user

13
00:00:55,620 --> 00:00:56,260
name.

14
00:00:56,540 --> 00:00:58,210
So I'll give this a descriptive name.

15
00:00:58,220 --> 00:01:05,290
How about something like Dr. re-act Travis C.I..

16
00:01:05,470 --> 00:01:11,110
And then underneath that I'm going to give programmatic access only the set of API keys that we're going

17
00:01:11,110 --> 00:01:17,800
to generate here are only going to be used by Travis see-I through network requests Chavasse is never

18
00:01:17,800 --> 00:01:25,560
going to be making direct use of the US management council Well then next for permissions and then we're

19
00:01:25,560 --> 00:01:28,550
going to attach existing policies directly.

20
00:01:28,710 --> 00:01:32,670
So we don't have any other policy groups or any other existing users.

21
00:01:32,730 --> 00:01:39,370
We're going to add some direct policies now these policies right here are essentially permissions.

22
00:01:39,410 --> 00:01:43,310
We are granting permissions to this new user that we are creating.

23
00:01:43,310 --> 00:01:47,630
So right now we're essentially listing out all the different things that this new user is going to have

24
00:01:47,630 --> 00:01:48,890
the ability to do.

25
00:01:49,250 --> 00:01:53,960
In particular we want to make sure that this new user has the ability to deploy your application to

26
00:01:53,990 --> 00:01:55,490
elastic beanstalk.

27
00:01:55,490 --> 00:02:02,430
So I'm going to search for beanstalk and then I'll see a bunch of different policies that have been

28
00:02:02,430 --> 00:02:05,120
pre-generated by AWOS appear here.

29
00:02:05,220 --> 00:02:07,160
You can look at the description of each.

30
00:02:07,170 --> 00:02:11,280
By far the easiest one to use is provides full access right here.

31
00:02:12,620 --> 00:02:17,240
So I'm going to make sure that I find provides full access and I'll go all the way over to the left

32
00:02:17,240 --> 00:02:27,890
hand side and click on that checkbox and then click on next review and then I'll create user so that

33
00:02:27,890 --> 00:02:32,820
generates a set of API keys that can be used by Travis see-I to deploy our application.

34
00:02:32,880 --> 00:02:34,180
And this is really important.

35
00:02:34,190 --> 00:02:39,730
The secret access key that has been generated is only going to be shown to exactly one time.

36
00:02:39,980 --> 00:02:44,780
So when you click on Show right here and it shows you that API key you need to make sure that you write

37
00:02:44,780 --> 00:02:50,300
this thing down because if you want to get access to this key again while you can you would have to

38
00:02:50,360 --> 00:02:52,390
regenerate the key entirely.

39
00:02:53,280 --> 00:02:57,600
So we're going to now use the Access Key ID and the secret access key.

40
00:02:57,600 --> 00:03:03,540
Now one quick thing we do not want to take those keys directly are keys and put them directly into a

41
00:03:03,540 --> 00:03:05,010
travesty YAML file.

42
00:03:05,070 --> 00:03:10,740
Remember right now our get HUD repository is entirely public so if we put those get up or see those

43
00:03:10,800 --> 00:03:16,050
AWOS keys into our repo and then push that up to get hub everyone in the world is going to have access

44
00:03:16,050 --> 00:03:21,060
to our AWOS account and so above all we're going to make sure that we do not put those keys directly

45
00:03:21,060 --> 00:03:22,080
in here.

46
00:03:22,200 --> 00:03:29,620
Instead we're going to make use of a feature of environment secrets provided by Travis C.I. so I'm going

47
00:03:29,620 --> 00:03:31,750
to go back over to my Travis dashboard.

48
00:03:31,760 --> 00:03:37,420
Remember you can get your at Travis dash C.I. dark and I'm going to pull up my project.

49
00:03:37,490 --> 00:03:40,380
So again I called my doc react.

50
00:03:40,400 --> 00:03:47,000
Then on the right hand side I'll find the more options and I'll go to settings we can then scroll down

51
00:03:47,000 --> 00:03:50,260
a little bit and find environment variables right here.

52
00:03:50,600 --> 00:03:56,090
So this right here is where we're going to stash those secret keys these environment variables are going

53
00:03:56,090 --> 00:03:59,040
to be encrypted and stored by Travis s.i.

54
00:03:59,150 --> 00:04:04,220
So we don't have to worry about outside people getting access to those keys and can making use of them

55
00:04:04,220 --> 00:04:05,160
in a bad way.

56
00:04:06,350 --> 00:04:10,140
With each key we provide a name any value for that key.

57
00:04:10,160 --> 00:04:15,450
So the first key that we're going to define as an environment variable is our access key.

58
00:04:15,920 --> 00:04:27,110
So I'm going to copy the access key then I'll provide a name over here of AWOS access key and I'll paste

59
00:04:27,200 --> 00:04:28,860
the value in like so.

60
00:04:29,330 --> 00:04:33,980
And notice how we're going to make sure that display value and build log is not checked because we do

61
00:04:33,980 --> 00:04:36,870
not want to display this value in the log.

62
00:04:37,580 --> 00:04:38,540
Well then click on Add.

63
00:04:38,620 --> 00:04:43,450
And as you can see essentially gets tucked away and I can no longer really get access to it.

64
00:04:47,850 --> 00:04:50,050
All right now we're going to do the secret as well.

65
00:04:50,230 --> 00:04:51,630
So a copy of The Secret.

66
00:04:51,660 --> 00:04:54,400
Make sure you get the entire secret.

67
00:04:54,480 --> 00:04:57,360
I'll go back over and define a second key.

68
00:04:57,510 --> 00:04:58,260
I'll call this one.

69
00:04:58,260 --> 00:05:01,080
AWOS secret key.

70
00:05:02,020 --> 00:05:03,990
And I'll paste in the valley for that as well.

71
00:05:04,170 --> 00:05:05,230
And then I'll hit add.

72
00:05:06,570 --> 00:05:11,940
All right so we've now got our two access keys are both the access key and the secret key successfully

73
00:05:11,940 --> 00:05:14,020
encrypted on Travis C.I..

74
00:05:14,430 --> 00:05:20,100
Well now go back over to our Travis you know file and inside of here we're going to say hey I have an

75
00:05:20,100 --> 00:05:25,080
access key for you but you're going to get it from the local environment configuration.

76
00:05:25,080 --> 00:05:34,580
So I'll say Access Key ID is going to come from the environment variable of dollar sign AWOS access

77
00:05:36,040 --> 00:05:48,960
key and for Secret Access Key we'll say secure AWOS secret key.

78
00:05:49,320 --> 00:05:52,220
And I personally actually had to wrap this in double quotes like so.

79
00:05:52,290 --> 00:05:54,120
So you might want to do that as well.

80
00:05:54,330 --> 00:05:56,400
According to the documentation I don't think you have to.

81
00:05:56,400 --> 00:05:59,420
But I found that you had to.

82
00:05:59,650 --> 00:06:00,990
OK so that's pretty much it.

83
00:06:00,990 --> 00:06:07,850
So now after Travis see-I attempts to build our project and run our tests it will then attempt to deploy

84
00:06:07,850 --> 00:06:10,930
our application over to elastic beanstalk.

85
00:06:11,010 --> 00:06:14,940
So as the very last thing we're going to commit all the work that we have now done and we're going to

86
00:06:14,940 --> 00:06:20,910
push it up to the master branch on get up again we're going to eventually use this kind of nice feature

87
00:06:20,910 --> 00:06:21,720
branch flow.

88
00:06:21,780 --> 00:06:23,870
But for now we just will make sure things are working.

89
00:06:23,880 --> 00:06:29,180
So we're going to push directly to master so I get to go back over to my terminal.

90
00:06:29,380 --> 00:06:33,430
I'll do it get status and just double check to make sure I change that file.

91
00:06:34,210 --> 00:06:38,610
I'll do it get ADD or get commit and I'll say something like add it.

92
00:06:38,640 --> 00:06:45,480
Travis deploy config and then I'll do get push or.

93
00:06:45,550 --> 00:06:50,440
MASTER.

94
00:06:50,460 --> 00:06:56,670
All right so now again if I flip back over to Travis C.I. and go back to my dashboard for my project

95
00:06:57,230 --> 00:07:01,730
in just a moment or two I'll see something appear right here and it says OK we're running a new build.

96
00:07:01,950 --> 00:07:05,850
And just like before you might have to refresh the page to get that to actually pop up.

97
00:07:05,920 --> 00:07:06,860
So I'll do so now.

98
00:07:07,910 --> 00:07:10,640
You know it's like it's not quite coming in just yet but it should.

99
00:07:10,640 --> 00:07:11,680
Just any moment.

100
00:07:11,690 --> 00:07:13,410
So let's take a quick break right here.

101
00:07:13,410 --> 00:07:16,230
I'll let the build finish up and we'll continue in the next section.
