How to Deploy to Amazon S3 Using GitLab CI/CD and AWS OIDC Without Access Keys
When you're learning AWS, Amazon S3 is one of the first services you're likely to encounter. Storage is a core component of cloud computing, and S3 makes it easy to store and manage files in the cloud.
If you've worked with S3 before, you probably know how to create a bucket and upload files manually through the AWS Management Console. But what happens when you need to deploy files regularly? Would you want to upload them by hand every time you make a change? That's where automation comes in.
In this tutorial, I'll show you how to automate file deployment to an Amazon S3 bucket using GitLab CI/CD. We'll also configure OpenID Connect (OIDC) to establish a secure connection between GitLab and AWS—without storing long-lived AWS access keys in GitLab CI/CD variables.
By the end of this tutorial, you'll know how to configure a GitLab CI/CD pipeline, connect GitLab to AWS using OIDC, and automatically deploy files to an S3 bucket whenever you push changes to your GitLab repository. This approach aligns with AWS's modern best practice of eliminating static, long-lived credentials—an expectation that has become standard across cloud security guidance heading into 2026.
Let's get started!
Table of Contents
- Prerequisites
- Why Should I Automate My Deployments?
- What Are the Advantages of This?
- What is CI/CD, and Why Does It Matter?
- What is OpenID Connect (OIDC), and Why Use It?
via FreeCodeCamp
