I know how to expire objects in an S3 bucket using object expiration rules given a certain prefix, however for my purposes, I would like to set the expiry date programmatica
Similarly to Eric's answer you could set a short bucket lifecycle policy and then use retention period locks (see the docs) to set expiration dates on a per-object basis.