►
Description
In this video, we will go through how to deploy a sample application (WordPress) to AWS EC2 using GitLab provided template and AWS CloudFormation, CodeDeploy, S3, and EC2 services
#AWS #CodeDeploy #GitLab #CI/CD
A
Hello,
everyone
thank
you
for
joining
me
in
this
session
today,
where
we
will
discuss
how
to
deploy
a
sample
wordpress
application
to
aws,
easy
to
instance,
using
gitlab
provider
template.
My
name
is
samurai
coop,
I'm
solution
architect
with
git
lab
and
I'm
based
in
melbourne,
australia.
These
are
my
contacts.
Please
feel
free
to
reach
out
and
connect
after
the
decision.
If
you
have
any
any
questions,
I'm
always
happy
to
connect
with
awesome
people
in
the
industry.
A
So
you
know
what
I
I
thought
the
best
way
in
order
to
understand
the
steps
for
automating
and
using
git
lab
pipeline
for
deploying
applications
to
amazon
ec2
instance
is
basically
to
use
the
same
sample.
Application
aws
is
using
in
their
documentation
to
explain
the
usage
of
code
deploy
for
deploying
applications
to
an
application
to
ec2
instance
and
and
so,
let's,
let's
review
together
quickly,
aws
documentation
for
this
sample.
So
basically,
this
is,
of
course
this
is
aws
documentation
and
when
the
steps
are
very
straightforward.
A
First,
you
have
to
create
a
linux
machine
right
to
in
order
to
to
deploy
the
application.
So
basically,
you
provision
that
linux
machine
and
you
prepare
the
security
rules
for
the
inbound
and
in
ba
access
to
that
machine.
And
then
you
prepare.
You
need
to
prepare
the
source
code
to
to
be
deployed
to
the
ec2
instance.
In
our
case,
it's
a
wordpress
application.
A
So
basically
we
are
pulling
that
wordpress
application,
creating
the
required
directory
structure
inside
that
that
application
right
and
then
creating
a
set
of
executable
files
that
will
be
used
during
the
deployment
will
be
executed
by
core
deploy
in
order
to
install
and
configure
the
wordpress
application.
So,
as
you
can
see
here,
we
will
we
need
to
create
an
install
dependencies,
application
file,
sorry
and
then
a
file
for
starting
the
server
file
for
stopping
the
server
and
file
for
creating
a
test
test
database.
A
It's
all
about
changing
the
access
and
then,
of
course,
adding
an
application
file.
So
this
is
where
you
need
to
create
a
a
specific
file
with
the
specific
name
spec.yemen
as
pair
aws
code
deploy
requirements
and
then
th.
This
is
where
we
we
will
specify
the
different
I
see
after
before
the
different
triggers,
where
the
the
files
we
created
above
will
be
used.
A
So
basically,
before
install
please
run
for
me
install
dependencies
and
that
install
dependencies
is
the
one
we
created
here
this
one
and
then,
of
course,
after
install
application
start
and
application
stop.
So
these
are
hooks
for
executing
certain
scripts
at
different
stages
of
the
application
deployment
right
cool.
So
so
far,
I've
created
an
ec2
instance:
we've
created
the
configuration
files
and
then
we
have
created
the
main
I'll
say
manifest
or
configuration
file
for
the
code
deploy
that
instruct
code
deploy
when
to
run
which
configuration
file
out
of
the
scripts
files
we
we
created
before.
A
Then
we
need
to
upload
upload
the
code
to
s3
bucket
right,
so
we
have
created
downloaded
the
wordpress
application.
We
created
the
required
folder
structure
inside
and
then
we
need
to
push
that
into
an
s3
bucket.
So,
basically,
you
need
to
create
an
s3
bucket,
create
the
proper
access
for
or
give
the
code
deploy
the
proper
access
to
that
to
that
bucket,
because,
of
course,
it
will
require
code.
A
Deploy
service
will
need
to
access
the
s3
in
order
to
pull
the
code,
the
wordpress
code,
and
then
here
you
need
to
register
an
application
using
create
application
command
and
then
push
use
aws
deploy
push,
deploy,
push
will.
Basically
what
we'll
do
is
we'll
go
into
the
created
wordpress
folder.
We
created
a
step
two
and
we'll
zip
that
folder
the
contents
of
that
folder
and
we'll
push
it
into
the
s3
bucket
we've
just
created
along
with
this
step,
will
create
the
application.
A
So
now
we
are
ready
to
deploy
the
application
right,
so
the
deploy
application
step
well,
basically,
first,
you
need
to
create
create.
Of
course
you
need
to
create
the
deployment
and
when
you
create
the
like
deployment,
basically
you're
thinking,
okay,
this
deployment
group
first
is
associated
with
that
with
the
ec2
instances.
With
these
filters-
and
of
course,
these
filters-
or
these
tags
are
the
same
tags
we
assigned
to
the
ec2
instance-
we
created
in
step
one.
A
So
basically,
I'm
telling
a
code
deploy
please
when
you
deploy
using
this
code,
deploy
group
this
the
code
deploy
group
is
associated
or
is
targeting
ec2
instances
with
with
these
these
tags,
and
then,
of
course,
you
need
to
create
the
association
which
basically
will
install
code
deploy
agent
into
that
ec2
instance,
of
course,
or
code.
Deploy
will
need
to
run
on
that
ec2
instance.
A
It
will
need
to
to
have
an
agent
installed
installed
there,
so
the
the
best
way
is
as
fairly
different
recommendation
is
you
need
to
use,
create
association
and
then,
of
course,
the
final
step
is
create
deployment
create
deployment
is
glowing
or
gathering
everything
together,
bringing
everything
together.
I
am
passing
the
code
the
deployment
group
we've
created.
I
am
passing
the
application
name,
the
one
we
created
in
step,
step
three
right
and
we're
choosing
the
deployment
config
name.
A
I
won't
go
into
the
details,
but
basically
this
the
the
dictates
how
you
want
to
provision
that
your
application?
What
is
the
strategy
for
provisioning
that
application,
and
in
this
case
it's
one
at
a
time
which
means
a
provision
everything
one
at
a
time,
how
many
running
instances
you
may
choose
to
have
like
blue
green
deployment
or
canary
deployment,
where
multiple
instances
of
the
same
application
at
some
point
can
be
running
and
and
and
right
and
of
course
here
I
am
telling
him
deploy
for
me.
A
The
application
you
will
find
under
this
bucket
with
that
application
name,
so
bring
everything
together
and
deploy
right.
So
I
wanted
to
review
this
with
you,
so
you
have
an
idea
on
the
steps
required
today
in
order
to
push
an
application
into
into
code,
deploy
into
sorry
into
using
code
deploy
into
aws
ec2
instance.
A
So
now,
let's
switch
to
the
gear.
Now,
let's
switch
into
the
git
lab
way
or,
let's
say
using
gitlab
provided
template,
and
just
to
give
you
a
background
when
I
say
template,
template
is
basically
set
of
commands
or
jobs
that
can
be
reused
in
many
pipelines
just
by
including
them,
so,
instead
of
retyping
them
or
copying
and
pasting
these
like
commands
in
each
and
every
pipeline,
where
they
are
required.
A
Simply
you
can
create
a
template
and
make
that,
like
a
reusable
piece
of
code,
where
you
can
include
it
just
by
doing
include
in
the
in
the
pipeline,
by
doing
that,
gitlab
has
created
for
our
customers
what
we
call
a
cloud
formation,
aws,
slash
cloud
formation,
dash
provision
dash
and
deploy
easy
to
get
club
cr,
which
is
basically
a
template.
That
will
save
you
most
of
the
steps
that
we
have
just
seen
in
the
in
the
in
in
aws
documentation.
A
These
all
steps
can
will
be
auto
automated
and
all
what
you
need
to
do
is
to
provide
the
configuration
files
right
where
how
you
want
to
create
the
infrastructure,
the
application
you
want
to
like
the
s3
bucket,
where
you
want
to
host
your
application
and
then
everything
else
will
be
will
be
automated.
A
A
I
am
responsible
for
building
my
application
right
and
making
it
available
in
on
a
path
where
artifacts
means
that
this
file
is
available
for,
for
I
mean
subsequent
jobs
to
use,
and
in
my
case
it
is
in
the
public
folder.
So
basically,
what
I'm
doing
here
I
am
using
whatever
in
this
case
I'm
using
the
ruby
image,
but
you
can
use
other
images
all
what
I'm
doing
here
is
I'm
making
a
folder
right.
A
I'm
copying
my
wordpress
application
from
the
ripple
where
this
project
is
hosted
right
and
copying
it
into
that
public
into
that
folder,
which
is
named
public
ls
just
for
to
confirm,
and
then
I'm
making
this
folder
as
an
artifact,
where
the
content
of
this
folder
can
be
will
be
preserved
to
be
accessed
by
subsequent
jobs
and
by
saying
subsequent
jobs.
These
are
the
jobs
included
in
this
template,
which
are
the
jobs
which
will
create
the
stack,
push
the
application
to
ec2
and
then
deploy
the
application,
create.
A
The
stack,
as
I
think
you
can
guess,
is
where
it's
similar
to
creating
the
ec2
instance
and
the
aws
aws
example
right.
So
this
is
where
the
template
will
go
and
create
the
required
infrastructure
in
aws
to
host
my
application
right.
So,
as
you
would
expect,
the
input
for
this
create
stack
is
adjacent
as
a
ml5.
That
tells
oh
sorry,
it's
a
json
file,
which
is
a
cloud
formation,
json
file
that
says:
okay,
basically,
please
take
this
file
and
create
for
me
an
infrastructure
using
cloud
formation
in
aws
provision.
For
me,
the
required
infrastructure.
A
Second,
it
is
the
second
job
is
push
to
s3.
The
second
job
is
in
the
in
the
template,
but
basically
push
to
s3
will
do
exactly
as
aws
code
deploy
push
which,
which
we
saw
in
in
aws
documentation
in
the
back
end,
it
is
using
that
that
command
it
will
wrap
whatever
available
for
deployment
right
and
push
it
into
a
target.
S3
s3
bucket,
and
the
question
here
is
what
it
will
run.
I
will
tell
you
it
will
rub
whatever
you
have
in
this
public
public
folder.
A
A
You
know
what
let's,
let's
switch
into
the
demo
mode?
Okay
right,
I
think
it's
it's
better.
So
this
is
the
pipeline
file.
I
was
I
was
referring
to
here
right,
and
this
is
the
job
I
was
just
describing
right
and
what
are
the
configuration
files
for
this
job
as
we
agreed?
First,
the
create
stack,
which
is
the
cloud
formation
stack
file
available
in
my
in
my
ripple
right.
So
let
me
switch
to
the
web
id
by
the
way.
Gitlab
provides
a
built-in
web
ide.
Where
I
can.
A
I
can
navigate
and
change
the
code
and
review
and
create
the
pipeline
without
without
even
leaving
the
platform
so
under
here.
You
see
that
I
have
it
says
here:
okay,
that
script
aws
is
available
under
this
folder.
So
if
I
go
under
aws
and
create
stack,
you
see
that
this
is
a
typical,
normal
cloud
formation
template
and
what
it's
doing
is
it
is
creating
an
application
in
aws,
creating
a
deployment
group
in
aws
and
basically
creating
an
ec2
instance
right.
It's
up
to
you.
You
can
go
beyond
just
creating
an
ec2
ec2
instance.
A
You
can
create
a
full
like
deployment.
A
I
mean
load
balancer,
target
groups,
auto
scalability
group,
all
the
required.
I
mean
networking
security
groups,
as
you
can
see
here,
it's
created
the
whole
thing
right.
It's
it's
a
typical
cloud
formation
template.
So
this
is
the
first
one.
Second,
one
is
basically
create
and
push
so.
This
is
a
simple.
This
says
please
take
whatever
in
the
public.
Folder
remember.
Where
is
that
public
folder?
This
is
where
it
came
from
here.
I
am
making
that
folder
right.
You
can
call
it
whatever
you
can
call
it
my
name
right.
A
You
can
call
it
whatever
you
want
it's.
Basically,
you
are
creating
a
folder.
You
are
making
it
available
so
that
the
copy
to
s3
job
can
access
it
and
that
copy
to
history.
How
it
will
know
about
this
job
using
because
I
am
in
the
deployment-
I
am
passing,
the
configuration
says.
Okay,
this
is
an
environment
variable
called
civilian.
A
It
has
to
be
the
same,
of
course,
the
same
name,
and
basically
I
am
I'm
passing
the
name
of
that
that
job
here,
so
it
is
available
here
and
the
third
one
is
basically
is
the
create
deployment
again.
This
is
the
json
file
for
the
create
deployment.
What
it's
doing
is
basically
I'm
taking
that
deployment.
Remember
this
one.
We
we
saw
it
in
aws
documentation,
deployment
group
the
same
the
name
of
the
deployment
group,
and
then
please
take
this
from
the
s3
bucket
again.
A
A
So
by
the
way
the
deployment
group
was
created
in
the
using
the
same
cf
in
the
same
step,
with
the
create
stack
using
the
cloud
formation
templates,
which
is
creating
for
me,
an
application
creating
for
me
application,
name
or
deployment
group
just
just
to
compare
these
two
are
the
same
as
these.
These
steps
here
excuse
me,
so
basically
it
is.
A
If
I
go
here,
this
is
where
I,
where
is
that,
so
this
is
the
the
one
that
pushed
the
application
and
if
I
go
to
the
deploy,
you
can
see
that
it's
created
a
deployment
group
so
that
deployment
group
and
then
the
create
the
deployment
is
same
as
creating
the
deployment
deployment
group
here
and
if
I
go,
I
think
here
under
the
application.
A
Add
an
application
file,
yep
yep,
you
know
so
so
this
is
where
it's
it's.
We
we
added
the
application
file
before
and
there
was
a
line
for
registering
the
application
itself
just
looking
for
that
somewhere
yeah
here.
It
is
so
that
this
is
the
the
line
where
we
registered
the
application,
and
this
is
where
the
same
exact
line,
where
we
are
using
cloud
stack
to
cloud
formation,
sorry
to
to
create
that
application,
so
the
end
result
is.
If
I
go
back
to
my
pipeline,
the
end
result
is
as
a
developer.
A
I
am
trying
to
deploy
an
application
to
aws
right
as
a
developer.
I
know
how
to
build
my
application,
and
this
is
where
I
will
build
my
application
to
deploy
to
aws.
What
do
I
need
to
do?
I
need
to
deploy
my
application
and
then
just
pass.
How
do
I
want
to
have
my
infrastructure,
my
application
pushed
and
the
deployment
to
be
there
and
to
do
that?
These
are
the
three
files
and,
by
the
way,
most
probably
most
of
the
time,
these
files
will
be.
The
same
are
very
similar
to
say
between
projects.
A
The
three
files
I'm
passing
the
main
files
are
create
stack,
which
is
responsible,
remember
responsible
for
creating
all
the
required
infrastructure,
provisioning,
provisioning,
the
ec2
instance
creating
the
deployment
group
and
creating
and
registering
an
application
in
aws.
Second,
one
is
the
push
to
history
which
will
take
the
code
I
have
built
in
my
public
folder,
the
one
I
defined
under
the
artifact
in
the
bill
job
and
I
will
pass
it
or
push
it
into
s3.
In
the
background
it
is
using,
it
is
calling
aws
deploy
command,
which
will
basically
package
the
code.
A
If
you
see
here
all
what
I've
done
is
I
just
copied
the
code
right
from
here
to
this
one.
So
it's
it's
not
it's
not
zip
file.
Yet
right.
So
once
this,
the
the
second
job
and
in
the
template
runs,
it
will
zip
the
file
and
make
it
available
in
the
back
in
the
packet
that
and
the
third
one
is
the
actual
deployment
which
basically
will
take
the
the
application
name.
We
created
in
the
create
stack.
A
The
deployment
group
which
was
created
in
the
create
stack
the
file,
which
was
the
zip
file
which
was
created
during
the
s3
bush,
push
step
and
then
do
the
deployment
to
the
target.
Ec2
instance.
The
end
result
is
applied
a
full
pipeline
out
of
just
having
just
including
one
template
and
just
adding
one
job
to
have
a
look
on
the
pipeline
itself
quickly.
A
Then
you
see
that
okay
I'll
just
forget
here,
so
it
will.
This
is
the
first
step
again
quiz.
What's
using
it's
using
create
stack
json
file
which
we
define,
so
this
will
create
the
stack.
This
is
the
only
build.
This
is
the
my
job.
This
is
the
it's
not
in
the
template.
This
is
the
job
where
I
build
my
application
and
if
you
remember,
I
made
it
available
in
the
public
folder
and
in
the
reviews
tip
actually
under
the
review
step.
A
There
are
two
stages:
easy
to
push
to
the
history
bucket
and
do
the
actual
deployment
which
is
take
the
code.
Take
the
application
name,
the
deployment
group
and
deploy
my
my
my
application.
The
end
result
is,
I
am
going
from
nothing
in
aws
console
into
a
completely
deployed
application
into
that
one.
So
I
won't
keep
you
waiting,
but
let
me
see
if
I
can
go
quickly
to
the
console.
A
A
A
I
won't
do
that
here,
so
it's
okay,
so
it
is
trust
me.
It
is
deploying
into
an
aws
instance
aws
deployment
and
yep
that
that
concludes
my
my
code
for
today,
my
demo
for
today.
Thank
you
very
much
and
I
hope
you
enjoyed
the
video.
Thank
you.