In the last section we added in a tremendous amount of configuration to our travel start YAML file.
Now last thing we have to add in here is a set of API keys that are going to give access to our account
over to Travis s.i.
The last thing we do is generate that set of API keys and then enter them into this travesty YAML script.
So let's get to it.
I'm going to first get started by opening up my AWOS console again.
I'll then find the services tab at the top and I'm going to search for I am I am.
Is this service that is used to manage API keys that can be used by outside services.
On the left hand side.
Ms Neumann here.
We're going to find the section of users because we're essentially going to get generate a new user
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
name.
So I'll give this a descriptive name.
How about something like Dr. re-act Travis C.I..
And then underneath that I'm going to give programmatic access only the set of API keys that we're going
to generate here are only going to be used by Travis see-I through network requests Chavasse is never
going to be making direct use of the US management council Well then next for permissions and then we're
going to attach existing policies directly.
So we don't have any other policy groups or any other existing users.
We're going to add some direct policies now these policies right here are essentially permissions.
We are granting permissions to this new user that we are creating.
So right now we're essentially listing out all the different things that this new user is going to have
the ability to do.
In particular we want to make sure that this new user has the ability to deploy your application to
elastic beanstalk.
So I'm going to search for beanstalk and then I'll see a bunch of different policies that have been
pre-generated by AWOS appear here.
You can look at the description of each.
By far the easiest one to use is provides full access right here.
So I'm going to make sure that I find provides full access and I'll go all the way over to the left
hand side and click on that checkbox and then click on next review and then I'll create user so that
generates a set of API keys that can be used by Travis see-I to deploy our application.
And this is really important.
The secret access key that has been generated is only going to be shown to exactly one time.
So when you click on Show right here and it shows you that API key you need to make sure that you write
this thing down because if you want to get access to this key again while you can you would have to
regenerate the key entirely.
So we're going to now use the Access Key ID and the secret access key.
Now one quick thing we do not want to take those keys directly are keys and put them directly into a
travesty YAML file.
Remember right now our get HUD repository is entirely public so if we put those get up or see those
AWOS keys into our repo and then push that up to get hub everyone in the world is going to have access
to our AWOS account and so above all we're going to make sure that we do not put those keys directly
in here.
Instead we're going to make use of a feature of environment secrets provided by Travis C.I. so I'm going
to go back over to my Travis dashboard.
Remember you can get your at Travis dash C.I. dark and I'm going to pull up my project.
So again I called my doc react.
Then on the right hand side I'll find the more options and I'll go to settings we can then scroll down
a little bit and find environment variables right here.
So this right here is where we're going to stash those secret keys these environment variables are going
to be encrypted and stored by Travis s.i.
So we don't have to worry about outside people getting access to those keys and can making use of them
in a bad way.
With each key we provide a name any value for that key.
So the first key that we're going to define as an environment variable is our access key.
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
the value in like so.
And notice how we're going to make sure that display value and build log is not checked because we do
not want to display this value in the log.
Well then click on Add.
And as you can see essentially gets tucked away and I can no longer really get access to it.
All right now we're going to do the secret as well.
So a copy of The Secret.
Make sure you get the entire secret.
I'll go back over and define a second key.
I'll call this one.
AWOS secret key.
And I'll paste in the valley for that as well.
And then I'll hit add.
All right so we've now got our two access keys are both the access key and the secret key successfully
encrypted on Travis C.I..
Well now go back over to our Travis you know file and inside of here we're going to say hey I have an
access key for you but you're going to get it from the local environment configuration.
So I'll say Access Key ID is going to come from the environment variable of dollar sign AWOS access
key and for Secret Access Key we'll say secure AWOS secret key.
And I personally actually had to wrap this in double quotes like so.
So you might want to do that as well.
According to the documentation I don't think you have to.
But I found that you had to.
OK so that's pretty much it.
So now after Travis see-I attempts to build our project and run our tests it will then attempt to deploy
our application over to elastic beanstalk.
So as the very last thing we're going to commit all the work that we have now done and we're going to
push it up to the master branch on get up again we're going to eventually use this kind of nice feature
branch flow.
But for now we just will make sure things are working.
So we're going to push directly to master so I get to go back over to my terminal.
I'll do it get status and just double check to make sure I change that file.
I'll do it get ADD or get commit and I'll say something like add it.
Travis deploy config and then I'll do get push or.
MASTER.
All right so now again if I flip back over to Travis C.I. and go back to my dashboard for my project
in just a moment or two I'll see something appear right here and it says OK we're running a new build.
And just like before you might have to refresh the page to get that to actually pop up.
So I'll do so now.
You know it's like it's not quite coming in just yet but it should.
Just any moment.
So let's take a quick break right here.
I'll let the build finish up and we'll continue in the next section.