Thank you for your question and for your interest in Mbed TLS!
Please note that ECDH is not a key generation function, but a scheme to exchange secrets.
If you wish to generate a key locally, I suggest you follow the instructions in https://tls.mbed.org/kb/how-to/generate-an-aes-key.
If you wish to share a key between your application and a remote peer ( e.g. client - server ), you should use ECDH key exchange algorithm, to exchange a key material, out of which your AES key should be derived using an agreed Key Derivation Function( KDF ) , which the key material would be given as input.
See code in TLS stack, for example:
Does this make sense?
Mbed TLS Team member