Here is a complete, working example of a .gitlab-ci.yml file that meets your requirements.
I have chosen a Python base image for this example because it makes installing the AWS CLI (via pip) extremely straightforward and fast for a test scenario.
Copy and paste this into your repository's CI/CD configuration file.
stages: