Hi, a developer on the EC2 team here: the underlying CPU topology, in terms of which logical processors share L3 caches (i.e., which CPUs are part of the same CCX [1]) is provided to the instance's operating system through ACPI tables and CPUID values. The m5a.24xlarge and r5a.24xlarge instances show two sockets, six NUMA nodes, and 12 L3 cache slices.

[ec2-user@ip-10-0-0-120 ~]$ likwid-topology
[...]
--------------------------------------------------------------------------------
Socket 0:	( 0 48 1 49 2 50 3 51 4 52 5 53 6 54 7 55 8 56 9 57 10 58 11 59 12 60 13 61 14 62 15 63 16 64 17 65 18 66 19 67 20 68 21 69 22 70 23 71 )
Socket 1:	( 24 72 25 73 26 74 27 75 28 76 29 77 30 78 31 79 32 80 33 81 34 82 35 83 36 84 37 85 38 86 39 87 40 88 41 89 42 90 43 91 44 92 45 93 46 94 47 95 )
--------------------------------------------------------------------------------
********************************************************************************
Cache Topology
********************************************************************************
Level:	1
Size:	32 kB
Cache groups:	( 0 48 ) ( 1 49 ) ( 2 50 ) ( 3 51 ) ( 4 52 ) ( 5 53 ) ( 6 54 ) ( 7 55 ) ( 8 56 ) ( 9 57 ) ( 10 58 ) ( 11 59 ) ( 12 60 ) ( 13 61 ) ( 14 62 ) ( 15 63 ) ( 16 64 ) ( 17 65 ) ( 18 66 ) ( 19 67 ) ( 20 68 ) ( 21 69 ) ( 22 70 ) ( 23 71 ) ( 24 72 ) ( 25 73 ) ( 26 74 ) ( 27 75 ) ( 28 76 ) ( 29 77 ) ( 30 78 ) ( 31 79 ) ( 32 80 ) ( 33 81 ) ( 34 82 ) ( 35 83 ) ( 36 84 ) ( 37 85 ) ( 38 86 ) ( 39 87 ) ( 40 88 ) ( 41 89 ) ( 42 90 ) ( 43 91 ) ( 44 92 ) ( 45 93 ) ( 46 94 ) ( 47 95 )
--------------------------------------------------------------------------------
Level:	2
Size:	512 kB
Cache groups:	( 0 48 ) ( 1 49 ) ( 2 50 ) ( 3 51 ) ( 4 52 ) ( 5 53 ) ( 6 54 ) ( 7 55 ) ( 8 56 ) ( 9 57 ) ( 10 58 )
( 11 59 ) ( 12 60 ) ( 13 61 ) ( 14 62 ) ( 15 63 ) ( 16 64 ) ( 17 65 ) ( 18 66 ) ( 19 67 ) ( 20 68 ) ( 21 69 ) ( 22 70 ) ( 23 71 ) ( 24 72 ) ( 25 73 ) ( 26 74 ) ( 27 75 ) ( 28 76 ) ( 29 77 ) ( 30 78 ) ( 31 79 ) ( 32 80 ) ( 33 81 ) ( 34 82 ) ( 35 83 ) ( 36 84 ) ( 37 85 ) ( 38 86 ) ( 39 87 ) ( 40 88 ) ( 41 89 ) ( 42 90 ) ( 43 91 ) ( 44 92 ) ( 45 93 ) ( 46 94 ) ( 47 95 )
--------------------------------------------------------------------------------
Level:	3
Size:	8 MB
Cache groups:	( 0 48 1 49 2 50 3 51 ) ( 4 52 5 53 6 54 7 55 ) ( 8 56 9 57 10 58 11 59 ) ( 12 60 13 61 14 62 15 63 ) ( 16 64 17 65 18 66 19 67 ) ( 20 68 21 69 22 70 23 71 ) ( 24 72 25 73 26 74 27 75 ) ( 28 76 29 77 30 78 31 79 ) ( 32 80 33 81 34 82 35 83 ) ( 36 84 37 85 38 86 39 87 ) ( 40 88 41 89 42 90 43 91 ) ( 44 92 45 93 46 94 47 95 )
--------------------------------------------------------------------------------
********************************************************************************
NUMA Topology
********************************************************************************
NUMA domains:	6
--------------------------------------------------------------------------------
Domain:	0
Processors:	( 0 48 1 49 2 50 3 51 4 52 5 53 6 54 7 55 )
Distances:	10 16 16 32 32 32
Free memory:	63028.4 MB
Total memory:	63291.6 MB
--------------------------------------------------------------------------------
Domain:	1
Processors:	( 8 56 9 57 10 58 11 59 12 60 13 61 14 62 15 63 )
Distances:	16 10 16 32 32 32
Free memory:	63202.6 MB
Total memory:	63375.1 MB
--------------------------------------------------------------------------------
Domain:	2
Processors:	( 16 64 17 65 18 66 19 67 20 68 21 69 22 70 23 71 )
Distances:	16 16 10 32 32 32
Free memory:	63171.3 MB
Total memory:	63375.1 MB
--------------------------------------------------------------------------------
Domain:	3
Processors:	( 24 72 25 73 26 74 27 75 28 76 29 77 30 78 31 79 )
Distances:	32 32 32 10 16 16
Free memory:	63322.8 MB
Total memory:	63375.1 MB
--------------------------------------------------------------------------------
Domain:	4
Processors:	( 32 80 33 81 34 82 35 83 36 84 37 85 38 86 39 87 )
Distances:	32 32 32 16 10 16
Free memory:	63318.7 MB
Total memory:	63375.1 MB
--------------------------------------------------------------------------------
Domain:	5
Processors:	( 40 88 41 89 42 90 43 91 44 92 45 93 46 94 47 95 )
Distances:	32 32 32 16 16 10
Free memory:	63317.7 MB
Total memory:	63374.1 MB
--------------------------------------------------------------------------------

[1] https://en.wikichip.org/wiki/amd/microarchitectures/zen#CPU_...