What is the portability of the compiled file across linux distros? I am building on Ubuntu currently. If my target is the Amazon Linux AMI (redhat based) will my ubuntu run on that platform?
The usual issue is libc, which is dynamically linked. If you rely on C code, that may be statically or dynamically linked; it depends on how you bind to the C code.
Dynamically linked glibc can be compatible between Ubuntu and RHEL and any others, but you'll usually get bitten by picking up newer symbol versions on one and trying to run that on the older. That's why the usual advice is to compile and link using the oldest glibc you need to be compatible with.
You can see a file's version requirements like: readelf -V your-file | grep "Name: GLIBC" -- and to a lesser extent, you may also need to check the same for GCC symbols (linked to libgcc_s.so). You can also try nm your-file | grep @ to see all versioned symbols you're linked to.
(Weak versioned symbols should be OK, e.g. w __cxa_thread_atexit_impl@@GLIBC_2.18)