Before building and flashing any firmware make sure you have esp-idf 5.1.1 installed and esp_aws_iot libraries installed.
To Install esp_aws_iot libraries, go to [YOUR_ESP_IDF_PATH]/components
in cmd and run the following commands to install esp_aws_iot v3.1.x as shown here.
git clone --recursive https://github.com/espressif/esp-aws-iot
cd esp-aws-iot
git checkout release/v3.1.x
git submodule update --recursive