Go mod download throws x509: certificate signed by unknown authority

I have got some experience in golang development on ubuntu desktop machines; however I have started with AWS ec2 instance, where I intend to do golang development.

I am having an ubuntu 24.04 ec2 instance on AWS. In this I intend to do golang development.

However the command
go mod download is throwing errors like the one pasted below:

go: github.com/gin-gonic/gin@v1.9.1: Get "https://proxy.golang.org/github.com/gin-gonic/gin/@v/v1.9.1.info": tls: failed to verify certificate: x509: certificate signed by unknown authority

How do I solve this? I tried to google on this issue however did not get any solution. I think I will need to do some setting in ec2 instance … but I do not know what and where.

Please let me know if I need to provide more details.
Thanks

Here are a few issues that can hopefully point you in the right direction. This isn’t a go problem so much as a networking problem: