I need to run pytest from bitbucket-pipelines with connection to an RDS database.
As my RDS test database is not publicly open, how can I get my pipeline IP to allow it to access to RDS?
A pipeline could be running on any number of addresses, and they can change. You'll need to enable the range(s) documented at https://support.atlassian.com/organization-administration/docs/ip-addresses-and-domains-for-atlassian-cloud-products/
What do you mean by "another solution"?
You have a service that you have asked a Cloud system to connect to. The Cloud system could be running on any one of a range of IP addresses. So if you want it to connect to your service, then you are going to have to allow all of those IP addresses through your firewall.