Yes, it is possible. This can be done using the Apex EmailService class. Once an email comes to Salesforce, the system can trigger the EmailService class, can read the S3 configuration and credentials from XfilesPro custom object, and upload the attachment in the email into an S3 bucket as the folder hierarchy is configured.
a) Each attachment file size cannot be more than 5 MB (for more sized files, a customer can use the Export Utility to export files to S3 in one click).
b) It can not be attached to a parent object like Account and Contact form an email. These can be achieved as a separate implementation.