How I can configure ansible playbook with pem.key

You showed how I could access remotely with login and password, but today we use ssh-key and pem with permission 400. How we can access AWS remotely using pem key inside the container? You can give an example with Dockerfile to access from a container the AWS EC2?