- [Narrator] Now we're getting very close
to having all the pieces in line
to build a top notch continuous deployment environment.
We just need a little bit more infrastructure first.
So let's take a moment to describe
what we're heading towards.
We'll have the Internet making web connections
to a load balancer.
This is an intermediate service,
that receives connections from the internet,
and forwards them to all the participating
Docker containers.
We're going to use Amazon's application load balancer
service for this.
The application load balancer's going to forward connections,
to all of the participating Docker containers.
And, in turn, each of those Docker containers
is of course running on an EC2 Instance,
and that instance is part of a cluster
maintained by the ECS Service.
The ECS Service is in turn being organized
in a service called CloudFormation.
Now, CloudFormation is an excellent, excellent tool
for managing these things.
It makes staying sane possible
in what would be an otherwise crazy environment.
And it's huge, there's a lot to learn about CloudFormation.
In this, we're going to cover a little bit of it,
and work through one example.
ECS itself is also really huge,
and covers a whole lot of different use cases.
Again, we're going to go through one example of using it.
And to wrap it all up, we're going to use Jenkins,
to manage the CloudFormation stacks.
So Jenkins will connect to AWS,
give it a configuration for the CloudFormation stack,
and then AWS will handle bringing it all into place.
So, before we get going, we have
a little bit more infrastructure to build.
Let's start by taking a look at the ECS cluster we're using.
Now, this is just the default cluster,
I made it with the default settings,
but I've already gone through the process
of configuring it to keep this demo shorter.
To get your ECS cluster set up,
head over to the ECS Service,
and then there'll be a Get Started window.
If you don't see a cluster here,
you can always create one by clicking the
Create Cluster button, and working your way
through the wizard.
If you'd like to learn more about ECS,
check out some of the other courses in our catalog.
The next thing we're going to need to do,
is empower Jenkins a little bit more.
I'm over here in the IAM service,
under roles, I want to scroll down here,
and I'm going to click on the role
we created earlier for Jenkins,
and I'm going to attach a few more permissions to that role.
We need to give Jenkins some permissions
for the IAM service.
I'm going to choose IAMFullAccess,
this allows Jenkins to create the stacks
that create policies.
Now we'll go ahead and click Attach policy,
okay, one more.
I also need to give Jenkins more access to the EC2 Service.
So I'm going to type ec2full into the search box here,
to narrow it down,
and choose EC2FullAccess.
Now, once again, remember that this is very broad access.
A production system in a security sensitive environment
will definitely need to have a custom policy made.
Okay, now that Jenkins has the permissions it needs,
let's go create that application load balancer
that will be directing the traffic to our service.
So here I am at the EC2 service,
and I'm going to scroll down here to Load Balancing,
Load Balancers,
and I don't currently have any.
So I'm going to create one.
And make sure you choose Application Load Balancer.
It's the only one that works with Docker containers.
Okay, let's give it a name,
production-website,
so nobody deletes it by accident.
And we want it to be listening,
under the Listeners section, to port 80,
on HTTP, it's fine for this service.
And for VPCs, again I'm choosing the VPC
that I've set up for this course.
You will of course have your own VPC to work with.
And for Availability Zones, I'm going to go ahead
and check them all, so that I make sure
I get the ones that are used.
Okay.
Click Next.
It's informing me that my service is open to the world,
it's a production web service,
so I'm comfortable with that.
Now I'm going to create a new security group.
This is the security group that controls
who can connect to your load balancer.
So, of course, we want that to be open to the world.
I'm going to name this production-website,
again, so nobody deletes it by accident,
port 80 is sufficient.
Now for configuring the routing.
We're creating the load balancer before we create the thing
that it will distribute traffic to.
So currently, we have no-one for this thing
to send traffic to.
And AWS requires you to define the target
at the time that you create the load balancer.
So we're just going to give it something.
I'm going to call this somehtingnotused.
Give it a name, the protocol and the port
don't actually matter,
and the path that it would be listening on
is /somethingasonlyanexample.
Okay, now let's talk about registering targets.
Again, we don't have any targets
for traffic to register this.
They haven't been created yet.
So we're just going to leave that blank,
and move on to review.
Read through here, make sure that it's internet-facing,
make sure that it's listening on port 80,
and that you recognize the VPC and the subnets.
Okay.
And now it's time to go ahead and click Create.
Our Load Balancer has been created.
One more thing before we go,
up here, under Actions, there's
an Edit security groups option, and Edit subnets,
if you're debugging this and it doesn't work,
these are excellent places to start fiddling.