Logging unencrypted AWS credentials can expose them to an attacker. Encrypt sensitive data, such as credentials, before they are logged to make the code more secure.