Now let's talk about mappings mappings are fixed variables within your confirmation template.
They have to be hardcoded.
They're very handy if you need to hardcore some values based on different environments you're in.
So Dev versus prod or regions such as it was regions or am I types cetera.
And as I said all the values must be written out explicitly in your template.
As an example here is a mapping and this is how you write it.
We have a mappings section and then you have the name of the mapping.
Then you have a key and then if you have keys called name and values.
So it's quite a low level type of architecture.
And so to make it more concrete we may have a region map to map regions to a amazed.
And so we're saying okay you within us east one U.S. West one or you one based on if you choose a 32
bit or 64 bit type of architecture here is the EMI idea you should be using.
So overall this is just a hard coding saying Okay based on where the template is being run.
This is the aim I want to use.
So when we use mapping and promoters well that things are great when you know in advance all the values
that can be taken.
So for example RMIT and so you can deduce them from married from variables such as region a produce
accounts environments et cetera whatever you can think of to me.
They allow safer control over the templates but if you need the values to be really user specific and
the user should input a value and you don't know in advance what it can be then you should use the parameters
now to access the mapping values there is this function called f and find a map.
And basically it returns a value from a specific key.
And the shorthand syntax is this one we use funding map with a little exclamation point.
And we have to give them that name and the top level key.
And the second level keeps the three parameters right here.
And so that's something you should know for the exam.
Just a syntax of it.
OK.
And so if we look at this a little confirmation template we can see we have a region map that we have
defined from before.
And so if we want to create an easy to instance you know in reference get the right AMH.
Then we use to find in MAP function for the image.
And so the first one is the map name so we'll use region map because here it's called region map.
The second is that we want to reference to the west region.
We're in so we're going to use this pseudo parameter we just talked about and the ref function.
So we reference the in this region the confirmation of it is running in.
So for example say we're running in US East 1 then we are in this block and then we say 32 as the second
level key.
So we look at the thirty two key and we get the value from it we'll get this EMI 6 4 1 1 e 22 D.
So this is the one that will be selected.
So this is all you should know about mapping just remembers just the syntax with the fine in MAP function
and the fact that mappings have to be written out explicitly in your templates.