Fix octect.to_s bug and AWS env variable logic