GitLab pipeline to upload a file to AWS S3

Create S3 bucket

Create IAM programmatic account: Add the keys to GitLab: Create .gitlab-ci.yaml in GitLab with the following contents:
deploy to s3:
    image:
        name: amazon/aws-cli
        entrypoint: [""]
    script:
        - aws --version
        - echo "Hello S3" > file.txt
	- aws s3 cp file.txt s3://$AWS_S3_BUCKET/file.txt
Commit and wait for pipeline to execute. Now you have your file on S3.

In other cases this option also could be used:
aws sync source_dir s3://bucket_name --delete