Refactoring for bugzid 3833, 3443 - should use existing AWSCloud#encode().