[Music]
idea I'm Kai a cloud support engineer
here at da SS cine office sometimes
customers ask me how they can reference
a resource in another cloud formation
stack during template creation in this
video I will explain the basic concept
about how to use a cross stack reference
and show you how to create it to create
a cross stack reference use the export
output field to flag the value of a
resource output for export then use the
FN import function to import the value
let me show you how to create an
instance using an import subnet and the
security group okay here we log into the
a SS measurement console let's click on
the cloud formation and the measurement
choose category
in this video I'm going to show you how
to use cross stack reference in between
stacks I already create a network a
stack for you in this stack you can see
that I'm actually exporting the subnets
and the security group value
you can find out that reference about
how to exporting these values from a
template in our documentation here
here's an example of the outfit
configuration you need to specify a name
and a value for this export to make it
work I'm going to create a new stack to
provision new easy to exists to use this
existing subnet any security group
exported from the network stack click on
create a stack and click on design
template
I have an existing template here
let me quickly show you what I'm doing
from here in this template I'm using a
parameter to reference the network stack
name as an input value in the resource
configuration for this ec2 instance I'm
using the subnet name exported from the
other stack using F an input value here
I'm also using a security group for this
configuration as well you can find the
documentation about how to configure
this in your template from our
documentation which is here remember
that you need to make sure that the name
that you're importing is the exact is
matching exactly what you're exporting
from the other stack I will show you how
to view them later let's go back to to
the confirmation stack and create a new
stack from this template
click on max and give it a name
here we need to specify the network
stack name parameter which is
referencing the other stacks name
let's click on this and I'll buy the new
tab so we can see this clearly the other
stack name is network stack so we just
copy this let's use this parameter as
the input value for the whole web server
stack click on next
next again
to create a dist AK
when the ec2 instances being provisioned
I quickly show you how to view the
exporter name from the other stack click
on Cal formation console here and use
the drop down list you can see the X
force value from this category here you
can see what exactly the value has been
outputted from the other stacks within
the same region remember that the
exporter name has to be unique for the
count per region this is the exporter
name that you're going to use in your
consumer stack as a FN input value this
name has to match exactly what you put
in the template to allow it to be able
to retrieve this export value you can
see the actual export value from here
and you can see the stack name let's go
back to the stack list
got our new ec2 instance provision
already click on the stack and you can
see the resource was actually using the
subnet ID and the security group from
our previous stack we can check this
from the ec2 console click on the ec2
console and click the instance that you
just created in the description of this
easy - console we can see that the
security group and the subnet has been
used and configure ectly
thanks for watching and happy cloud
computing from all of us here at aw
[Music]
you
[Music]