Without knowing what you've tried, it's a bit difficult to help.
Have you tried something like this?
<rewrite>
<rules>
<rule name="Rewrite to s3" stopProcessing="true">
<match url="^productimages/(.*)" />
<action type="Rewrite" url="s3/mybucketname/{R:1}" appendQueryString="true" redirectType="Found" />
</rule>
</rules>
</rewrite>