Is it possible to implement AWS RTOS on nrf51822? If not what is the alternative solution for connecting nrf51822 to IoT cloud?
The NRF51822 is a Bluetooth low energy device, which is mostly chosen for low power applications. It cannot access the internet using Bluetooth (unless your idea is to access the internet using bluetooth or something of that sort). If your application needs internet access, you should be moving to 802.11a/b/g/n or 2G/3G/4G.
So if internet access if what you're looking after, you can choose other options like the Noode MCU, ESP8266 or ESP-32. These are WiFi devices can can access the internet using the IP Stack.
Here you'll be able to use AWS Free RTOS, ChibiOS and other RTOS based systems with the MQTT library