Connecting Arduino uno to node-red using mqtt

I want to send data from an arduino uno to nodered using mqtt. In my project i am connecting gas sensors and temperature and humidity sensors to uno board. After receiving the data i want to send it to nodered.
I dont want to use a local broker that is installed in my pc rather i want to send it through awsiot broker.

To access the awsiot broker should i be connected to the internet. If yes i want to connect the arduino to the internet using an esp8266-01 since i have one with me. I don't wanna buy any other shield. If this is possible please help me out.

This is my first post on any forum so kindly excuse me if i have broken any rules and do feel free to point out my mistakes so that i don't repeat them.

Welcome to the forum!

Your plan is possible but somewhat difficult for the following reasons

  1. Uno is a 5V device but the ESP8266-01 is 3v3 so you will need to reduce the voltage from the UNO TX pin to avoid damaging the RX input on the ESP8266. Its OK to connect the ESP8266 TX pin to the Uno RX though.

  2. The standard firmware of an ESP8266-01 only supports the AT command set which (as far as I know) doesnt implement MQTT. You will need to re-flash your ESP8266 using either an arduino sketch or nodemcu. This means you need a USB to TTL board (something like this)

It may be easier to leave the Uno in the drawer and get a standalone ESP8266 dev board such as a Wemos or Huzzah

Its always good to include links where you mention a product: when you say awsiot do you mean this?: Getting started with AWS IoT Core - AWS IoT Core

Hope this helps..

Instead of using an esp8266-01 to send data over wifi can i serially connect(Dr. Monk's DIY Electronics Blog: Raspberry Pi and Arduino) uno to raspberry pi3 and publish all the sensor data using mqtt to nodered through raspberry pi3.

Definitely! I’ve used a similar config myself for testing.

See Connect Raspberry Pi and Arduino with Serial USB Cable - Oscar Liang

However you may need to disable the serial console as per This is packaged up into a script at GitHub - lurch/rpi-serial-console: Simple script to easily enable & disable the Raspberry Pi's serial console (this worked for RPi1 like mine so see the note about later models)