How can your EC2 instance connect to other AWS Services
First, It is really bad practice to setup your AWS credentials (AWS Access Key) into an EC2 instance in order to give it access to other services. Because anyone who can access that EC2 can retrieve your credentials
So, the correct way is to set up an IAM Role to your EC2