1
00:00:00,090 --> 00:00:04,800
Now let's talk about mappings mappings are fixed variables within your confirmation template.

2
00:00:04,800 --> 00:00:06,170
They have to be hardcoded.

3
00:00:06,390 --> 00:00:11,120
They're very handy if you need to hardcore some values based on different environments you're in.

4
00:00:11,130 --> 00:00:15,660
So Dev versus prod or regions such as it was regions or am I types cetera.

5
00:00:15,810 --> 00:00:19,380
And as I said all the values must be written out explicitly in your template.

6
00:00:19,380 --> 00:00:22,750
As an example here is a mapping and this is how you write it.

7
00:00:22,790 --> 00:00:25,850
We have a mappings section and then you have the name of the mapping.

8
00:00:25,860 --> 00:00:30,300
Then you have a key and then if you have keys called name and values.

9
00:00:30,360 --> 00:00:34,400
So it's quite a low level type of architecture.

10
00:00:34,500 --> 00:00:39,830
And so to make it more concrete we may have a region map to map regions to a amazed.

11
00:00:39,900 --> 00:00:46,800
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

12
00:00:46,800 --> 00:00:52,880
bit or 64 bit type of architecture here is the EMI idea you should be using.

13
00:00:52,890 --> 00:00:58,270
So overall this is just a hard coding saying Okay based on where the template is being run.

14
00:00:58,320 --> 00:01:00,900
This is the aim I want to use.

15
00:01:00,900 --> 00:01:05,460
So when we use mapping and promoters well that things are great when you know in advance all the values

16
00:01:05,460 --> 00:01:06,710
that can be taken.

17
00:01:06,720 --> 00:01:12,390
So for example RMIT and so you can deduce them from married from variables such as region a produce

18
00:01:12,410 --> 00:01:16,540
accounts environments et cetera whatever you can think of to me.

19
00:01:16,560 --> 00:01:22,710
They allow safer control over the templates but if you need the values to be really user specific and

20
00:01:22,710 --> 00:01:27,810
the user should input a value and you don't know in advance what it can be then you should use the parameters

21
00:01:28,740 --> 00:01:33,450
now to access the mapping values there is this function called f and find a map.

22
00:01:33,690 --> 00:01:36,460
And basically it returns a value from a specific key.

23
00:01:37,170 --> 00:01:43,610
And the shorthand syntax is this one we use funding map with a little exclamation point.

24
00:01:43,860 --> 00:01:46,790
And we have to give them that name and the top level key.

25
00:01:46,800 --> 00:01:50,530
And the second level keeps the three parameters right here.

26
00:01:50,580 --> 00:01:52,400
And so that's something you should know for the exam.

27
00:01:52,400 --> 00:01:53,550
Just a syntax of it.

28
00:01:53,820 --> 00:01:54,670
OK.

29
00:01:54,690 --> 00:02:00,150
And so if we look at this a little confirmation template we can see we have a region map that we have

30
00:02:00,150 --> 00:02:01,160
defined from before.

31
00:02:01,530 --> 00:02:07,150
And so if we want to create an easy to instance you know in reference get the right AMH.

32
00:02:07,500 --> 00:02:11,100
Then we use to find in MAP function for the image.

33
00:02:11,310 --> 00:02:17,220
And so the first one is the map name so we'll use region map because here it's called region map.

34
00:02:17,220 --> 00:02:20,230
The second is that we want to reference to the west region.

35
00:02:20,310 --> 00:02:24,250
We're in so we're going to use this pseudo parameter we just talked about and the ref function.

36
00:02:24,480 --> 00:02:28,340
So we reference the in this region the confirmation of it is running in.

37
00:02:28,350 --> 00:02:34,650
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

38
00:02:34,650 --> 00:02:35,330
level key.

39
00:02:35,460 --> 00:02:41,610
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.

40
00:02:41,610 --> 00:02:43,240
So this is the one that will be selected.

41
00:02:43,710 --> 00:02:48,840
So this is all you should know about mapping just remembers just the syntax with the fine in MAP function

42
00:02:49,200 --> 00:02:53,040
and the fact that mappings have to be written out explicitly in your templates.
