<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/"
    xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" version="2.0">
    <channel>
        
        <title>
            <![CDATA[ GitLab-CI - freeCodeCamp.org ]]>
        </title>
        <description>
            <![CDATA[ Browse thousands of programming tutorials written by experts. Learn Web Development, Data Science, DevOps, Security, and get developer career advice. ]]>
        </description>
        <link>https://www.freecodecamp.org/news/</link>
        <image>
            <url>https://cdn.freecodecamp.org/universal/favicons/favicon.png</url>
            <title>
                <![CDATA[ GitLab-CI - freeCodeCamp.org ]]>
            </title>
            <link>https://www.freecodecamp.org/news/</link>
        </image>
        <generator>Eleventy</generator>
        <lastBuildDate>Thu, 26 Nov 2026 06:31:13 +0000</lastBuildDate>
        <atom:link href="https://www.freecodecamp.org/news/tag/gitlab-ci/rss.xml" rel="self" type="application/rss+xml" />
        <ttl>60</ttl>
        
            <item>
                <title>
                    <![CDATA[ How to Deploy to Amazon S3 Using GitLab CI/CD and AWS OIDC Without AWS Access Keys ]]>
                </title>
                <description>
                    <![CDATA[ When you're learning AWS, Amazon S3 is one of the services you're likely to come across early. Storage is one of the core components of cloud computing, and S3 makes it easy to store and manage files  ]]>
                </description>
                <link>https://www.freecodecamp.org/news/how-to-deploy-to-amazon-s3-using-gitlab-ci-cd-and-aws-oidc-without-aws-access-keys/</link>
                <guid isPermaLink="false">6b073bc61949010821f01797</guid>
                
                    <category>
                        <![CDATA[ AWS ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Devops ]]>
                    </category>
                
                    <category>
                        <![CDATA[ GitLab-CI ]]>
                    </category>
                
                    <category>
                        <![CDATA[ OIDC ]]>
                    </category>
                
                    <category>
                        <![CDATA[ ci-cd ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Ijeoma Igboagu ]]>
                </dc:creator>
                <pubDate>Wed, 25 Nov 2026 19:49:25 +0000</pubDate>
                <media:content url="https://cdn.hashnode.com/uploads/covers/5e1e335a7a1d3fcc59028c64/6c616b65-646a-49ca-8d72-22ce52ea4426.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>When you're learning AWS, Amazon S3 is one of the services you're likely to come across early. Storage is one of the core components of cloud computing, and S3 makes it easy to store and manage files in the cloud.</p>
<p>If you've worked with S3 before, you probably know how to create a bucket and manually upload files through the AWS Management Console. But what happens when you need to deploy files regularly? Would you want to keep uploading them manually every time you make a change? This is where automation comes in.</p>
<p>In this tutorial, I'll show you how to automate the deployment of files 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.</p>
<p>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.</p>
<p>Let's get started!</p>
<img src="https://cdn.hashnode.com/uploads/covers/609ec473b684eb4cd52c74a3/05ba1c9d-9b8a-42c2-9a8d-3dee9aa02621.gif" alt="let get started with tutorial" style="display: block;" width="1674" height="438" loading="lazy">

<h2 id="heading-table-of-contents">Table of Contents</h2>
<ul>
<li><a href="#heading-prerequisites">Prerequisites</a></li>
<li><a href="#heading-why-should-i-automate-my-deployments">Why Should I Automate My Deployments?</a><ul>
<li><a href="#heading-what-are-the-advantages-of-this">What Are the Advantages of This?</a></li>
</ul>
</li>
<li><a href="#heading-what-is-cicd-and-why-does-it-matter">What is CI/CD, and Why Does it Matter?</a></li>
<li><a href="#heading-what-is-openid-connect-oidc-and-why-use-it">What is OpenID Connect (OIDC), and Why Use it?</a><ul>
<li><a href="#heading-advantages-of-using-oidc">Advantages of Using OIDC</a></li>
<li><a href="#heading-are-there-any-disadvantages">Are There Any Disadvantages?</a></li>
</ul>
</li>
<li><a href="#heading-step-1-prepare-your-website-files-code-and-upload-them-to-gitlab">Step 1: Prepare Your Website Files (Code) and Upload Them to GitLab</a></li>
<li><a href="#heading-step-2-create-an-amazon-s3-bucket">Step 2: Create an Amazon S3 Bucket.</a></li>
<li><a href="#heading-step-3-give-your-s3-bucket-public-access">Step 3: Give Your S3 Bucket Public Access</a></li>
<li><a href="#heading-step-4-enable-static-website-hosting">Step 4: Enable Static Website Hosting</a></li>
<li><a href="#heading-step-5-configure-aws-iam-for-gitlab-oidc-authentication">Step 5: Configure AWS IAM for GitLab OIDC Authentication</a><ul>
<li><a href="#heading-how-to-create-an-oidc-identity-provider-in-aws">How to Create an OIDC Identity Provider in AWS</a></li>
</ul>
</li>
<li><a href="#heading-step-6-create-an-iam-role-for-gitlab">Step 6: Create an IAM Role for GitLab</a></li>
<li><a href="#heading-step-7-attach-s3-permissions-to-the-iam-role">Step 7: Attach S3 Permissions to the IAM Role</a></li>
<li><a href="#heading-step-8-configure-gitlab-cicd-variables">Step 8: Configure GitLab CI/CD Variables</a></li>
<li><a href="#heading-step-9-create-the-gitlab-cicd-pipeline">Step 9: Create the GitLab CI/CD Pipeline</a></li>
<li><a href="#heading-step-10-verify-the-deployment-on-amazon-s3">Step 10: Verify the Deployment on Amazon S3</a></li>
<li><a href="#heading-step-11-re-testing-deployment">Step 11: Re-Testing Deployment</a></li>
<li><a href="#heading-step-12-test-the-error-page">Step 12: Test the Error Page</a></li>
<li><a href="#heading-step-11-clean-up-your-aws-resources">Step 11: Clean Up Your AWS Resources</a></li>
<li><a href="#heading-conclusion">Conclusion</a></li>
</ul>
<h2 id="heading-prerequisites">Prerequisites</h2>
<p>Before getting started, make sure you have the following:</p>
<ul>
<li>A basic understanding of cloud computing and AWS.</li>
<li>An <a href="https://aws.amazon.com/free/">AWS account</a>.</li>
<li>A <a href="https://gitlab.com/">GitLab</a> account to store your code and automate deployment.</li>
<li>A code editor like VS Code, Atom, or Sublime</li>
</ul>
<p><strong>Note:</strong> I'll be using GitLab for this tutorial. If you use GitHub instead, you can also get the same result using GitHub Actions. Both platforms support automated deployment.</p>
<p>Before setting up Amazon S3 for automated deployment, let's take a step back and understand why this approach is worth learning.</p>
<p>You might be wondering, why should I automate file deployment? What are the advantages? These are valid questions, and understanding the answers will help you see where automation fits into your cloud workflow.</p>
<p>Let's look at them before moving on to the practical steps.</p>
<h2 id="heading-why-should-i-automate-my-deployments">Why Should I Automate My Deployments?</h2>
<p>Imagine your website is hosted on Amazon S3. Every time you make a change, you have to log in to the AWS Console, open your S3 bucket, and manually upload the new files.</p>
<p>That is fine for a small project that rarely changes. But what if you need to update your site often?</p>
<p>Uploading files by hand repeatedly gets boring and takes some time.</p>
<p>This is where automation helps. With GitLab CI/CD or GitHub Actions, you can set up a pipeline that sends your files to S3 for you. Every time you push changes to GitLab, the pipeline runs and deploys your site.</p>
<p>So instead of uploading files yourself, GitLab does it for you.</p>
<h3 id="heading-what-are-the-advantages-of-this">What Are the Advantages of This?</h3>
<p>Using GitLab CI/CD to deploy files to Amazon S3 has several advantages:</p>
<ol>
<li>Faster deployment: Once the pipeline is set up, you just push your changes to GitLab, and the deployment starts on its own.</li>
<li>Fewer mistakes: The pipeline follows the same steps every time, so you're less likely to forget a file or upload the wrong version.</li>
<li>Less manual work: You don't have to repeat the upload process through the AWS Console whenever you update your files.</li>
<li>Version control: Your website files live in GitLab, so you can track changes, look at old commits, and see what was updated.</li>
</ol>
<h2 id="heading-what-is-cicd-and-why-does-it-matter">What is CI/CD, and Why Does it Matter?</h2>
<p>CI/CD stands for Continuous Integration and Continuous Delivery or Continuous Deployment.</p>
<p>In simple terms, it's a way to automate the steps of testing and deploying your code, so you don’t have to do each step by hand. Think of it as giving a set of instructions to follow whenever you push changes to your repository.</p>
<p>In this tutorial, GitLab CI/CD will deploy your files to Amazon S3. When you push changes to your GitLab repository, GitLab starts a pipeline. The pipeline follows the steps you wrote in your <code>.gitlab-ci.yml</code> file and uploads your updated files to your S3 bucket.</p>
<p>As I said earlier, CI/CD makes deployment easier, saves you from repeating the same work, and keeps your deployment process the same every time.</p>
<h2 id="heading-what-is-openid-connect-oidc-and-why-use-it">What is OpenID Connect (OIDC), and Why Use it?</h2>
<p>We'll use OpenID Connect (OIDC) in this tutorial to connect GitLab to AWS safely. But what is OIDC, and why do we need it?</p>
<p>OIDC is a way for one service to prove who it is to another service. In our case, it lets GitLab prove its identity to AWS.</p>
<p>Without OIDC, you would have to save your AWS access keys in GitLab. These keys don't expire, so if someone gets hold of them, they can use your AWS account.</p>
<p>With OIDC, you don't save any keys. When your pipeline runs, GitLab proves its identity to AWS, and AWS gives it a temporary key. This key stops working after the job is done. This is safer, and you have no long-term keys to store or manage.</p>
<h3 id="heading-advantages-of-using-oidc">Advantages of Using OIDC</h3>
<ul>
<li>You don't need to store permanent AWS access keys in GitLab.</li>
<li>AWS provides credentials that expire after a set period.</li>
<li>OIDC reduces the risk of exposing long-term AWS credentials.</li>
</ul>
<h3 id="heading-are-there-any-disadvantages">Are There Any Disadvantages?</h3>
<p>The initial setup requires some additional configuration in AWS IAM and GitLab. You need to configure the identity provider, IAM role, and permissions before the connection can work.</p>
<p>But once it's configured, you can reuse this authentication setup for your deployment pipeline.</p>
<p>Now that you understand why we're using GitLab CI/CD and OIDC, let's move on to the practical part and set everything up.</p>
<h2 id="heading-step-1-prepare-your-website-files-code-and-upload-them-to-gitlab">Step 1: Prepare Your Website Files (Code) and Upload Them to GitLab</h2>
<p>Before you can deploy your website to Amazon S3, you need to create the website files and upload them to your GitLab repository.</p>
<p>Open your preferred code editor, such as VS Code and create a new project folder named <code>s3-website</code>.</p>
<p>Inside the folder, create two HTML files:</p>
<ul>
<li><code>index.html</code>: This will be the homepage visitors see when they open your website.</li>
<li><code>error.html</code>: This will be displayed when a visitor encounters an error.</li>
</ul>
<p>Write your HTML code in each file and save your changes.</p>
<p>Then open <code>index.html</code> in your browser to check that the homepage displays correctly. Test <code>error.html</code> to make sure it displays as expected.</p>
<p>Once you're satisfied with the files, open your GitLab repository and upload both HTML files to the repository. Then commit your changes to the <code>main</code> branch.</p>
<p>Your GitLab repository should now contain:</p>
<pre><code class="language-text">practice-action-aws/
├── index.html
└── error.html
</code></pre>
<p>These are the files your GitLab CI/CD pipeline will automatically deploy to the S3 bucket.</p>
<h2 id="heading-step-2-create-an-amazon-s3-bucket">Step 2: Create an Amazon S3 Bucket</h2>
<p>The next step is to create an S3 bucket where GitLab will deploy your files.</p>
<p>To do this, sign in to the AWS Management Console, search for S3, and open the service. Click Create bucket.</p>
<p>Enter a unique name for your bucket. For example, <code>gitlab-s3-deployment-demo-bucket</code>. You'll also need to select the AWS Region where you want to create the bucket. Remember the region because you'll need it later when configuring GitLab.</p>
<img src="https://cdn.hashnode.com/uploads/covers/609ec473b684eb4cd52c74a3/6ac72e76-c154-4761-9d05-4d9cb6d151ed.png" alt="Creation of AWS S3 bucket" style="display: block;" width="1639" height="821" loading="lazy">

<h2 id="heading-step-3-give-your-s3-bucket-public-access">Step 3: Give Your S3 Bucket Public Access</h2>
<p>Now that you've created your S3 bucket, the next step is to give it public access.</p>
<p>We're doing this for learning purposes here so we can demonstrate how publicly accessible files work. In a real-world production environment, you should avoid making your S3 bucket public unless there's a specific requirement and appropriate security controls are in place.</p>
<p>To give it public access, click on the bucket you created. Then click the Permissions tab at the top.</p>
<img src="https://cdn.hashnode.com/uploads/covers/609ec473b684eb4cd52c74a3/6c5450ba-4ead-4c3e-b83d-9b9355035247.png" alt="Giving the AWS S3 bucket permission " style="display: block;" width="1153" height="138" loading="lazy">

<p>Locate Block public access (bucket settings) and click Edit. Uncheck Block all public access. AWS will display a warning. Read it, acknowledge the change, and click Save changes.</p>
<p>Next, scroll down to the bucket policy and click Edit. Paste the bucket policy below, replacing the existing content if necessary.</p>
<pre><code class="language-json">{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "PublicReadGetObject",
      "Effect": "Allow",
      "Principal": "*",
      "Action": "s3:GetObject",
      "Resource": "arn:aws:s3:::gitlab-s3-deployment-demo-bucket/*"
    }
  ]
}
</code></pre>
<p>Click Save changes.</p>
<img src="https://cdn.hashnode.com/uploads/covers/609ec473b684eb4cd52c74a3/0d9c1fd7-5112-4ffc-b7f5-279f6d8274b1.gif" alt="This is to allow public read of our bucket" style="display: block;" width="1852" height="1018" loading="lazy">

<p>The next step is to enable static website hosting. This is important because we don't just want to deploy files to S3 automatically. We want to make our website accessible through a browser.</p>
<h2 id="heading-step-4-enable-static-website-hosting">Step 4: Enable Static Website Hosting</h2>
<p>Now that you've configured public access, let's enable static website hosting for your S3 bucket.</p>
<p>To start, click on the Properties tab. Scroll down to the Static website hosting section and click Edit.</p>
<p>Under Static website hosting, select Enable. Then select Host a static website as the hosting type.</p>
<p>Under the Index document, enter <code>index.html</code>. Same for the error field <code>error.html</code>. Click Save changes.</p>
<p>Once saved, scroll back to the Static website hosting section. You should see your website endpoint.</p>
<p>This endpoint is the URL through which visitors can access your website.</p>
<img src="https://cdn.hashnode.com/uploads/covers/609ec473b684eb4cd52c74a3/02443688-c7a3-4872-94a9-4c01252dfa47.gif" alt="next step show how to get endpoint url " style="display: block;" width="1852" height="1018" loading="lazy">

<h2 id="heading-step-5-configure-aws-iam-for-gitlab-oidc-authentication">Step 5: Configure AWS IAM for GitLab OIDC Authentication</h2>
<p>Now that your S3 bucket is set up for static website hosting, the next step is to set up AWS IAM.</p>
<p>We need to permit GitLab to upload files to your S3 bucket whenever you push changes to your repository.</p>
<p>To do this, we'll use OIDC. It lets GitLab connect to AWS and get temporary credentials, so you don't have to save long-term AWS access keys in GitLab.</p>
<h3 id="heading-how-to-create-an-oidc-identity-provider-in-aws">How to Create an OIDC Identity Provider in AWS</h3>
<p>Search for IAM and open it. In the left menu, click Identity providers. Then click Add provider.</p>
<p>Select OpenID Connect as the provider type and enter these details:</p>
<table>
<thead>
<tr>
<th>Field</th>
<th>Value</th>
</tr>
</thead>
<tbody><tr>
<td>Provider URL</td>
<td><code>https://gitlab.com</code></td>
</tr>
<tr>
<td>Audience</td>
<td><a href="http://sts.amazonaws.com"><code>sts.amazonaws.com</code></a></td>
</tr>
</tbody></table>
<ol start="7">
<li>Click <strong>Add provider</strong>.</li>
</ol>
<img src="https://cdn.hashnode.com/uploads/covers/609ec473b684eb4cd52c74a3/f6514156-3d66-4742-a889-2a1f3bc492aa.gif" alt="Adding identity provider" style="display: block;" width="1852" height="1018" loading="lazy">

<p>This tells AWS to trust GitLab as an identity provider. In the next step, you'll create an IAM role that uses it.</p>
<h2 id="heading-step-6-create-an-iam-role-for-gitlab">Step 6: Create an IAM Role for GitLab</h2>
<p>Now that you've created the OIDC identity provider, you'll need to create an IAM role that GitLab can assume to access your S3 bucket.</p>
<p>This role will define what GitLab is allowed to do in your AWS account.</p>
<p>To start, click Roles in the left navigation panel or follow the on-screen banner, then click Create role.</p>
<ul>
<li>Under Trusted entity type, select <code>Web identity</code></li>
<li>Under Identity Provider, select <code>gitlab.com</code></li>
<li>Under Audience, select <code>sts.amazonaws.com</code></li>
<li>Under Group type, in your <code>username</code></li>
</ul>
<p>The other fields are optional.</p>
<p>Then click Next and Next. Finally, click the Create role button.</p>
<img src="https://cdn.hashnode.com/uploads/covers/609ec473b684eb4cd52c74a3/5c895f0e-b1f2-44de-a48c-3091a9726060.gif" alt="Creating the roles for AWS to connect to gitlab " style="display: block;" width="1852" height="1018" loading="lazy">

<h2 id="heading-step-7-attach-s3-permissions-to-the-iam-role">Step 7: Attach S3 Permissions to the IAM Role</h2>
<p>Select the role you just created and open the Permissions tab. Click Add permissions. Then select Create Inline Policy and select the JSON tab.</p>
<p>Replace the existing content with this policy:</p>
<pre><code class="language-json">{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "ListS3Bucket",
      "Effect": "Allow",
      "Action": "s3:ListBucket",
      "Resource": "arn:aws:s3:::gitlab-s3-deployment-demo-bucket"
    },
    {
      "Sid": "UploadAndDeleteObjects",
      "Effect": "Allow",
      "Action": [
        "s3:PutObject",
        "s3:DeleteObject"
      ],
      "Resource": "arn:aws:s3:::gitlab-s3-deployment-demo-bucket/*" 
    }
  ]
}
</code></pre>
<p><strong>Note:</strong> Replace the bucket name in the <code>Resource</code> ARN above with your own S3 bucket name. The bucket name used in this tutorial is for demonstration purposes.</p>
<p>Then click Next. Enter the policy name and click Create policy.</p>
<img src="https://cdn.hashnode.com/uploads/covers/609ec473b684eb4cd52c74a3/f754416a-f796-4400-b4a6-c4d8c2b0553e.gif" alt="AWS roles created this allow OIDC" style="display: block;" width="1852" height="1018" loading="lazy">

<p>So what do these permissions mean?</p>
<table>
<thead>
<tr>
<th>Permission</th>
<th>Purpose</th>
</tr>
</thead>
<tbody><tr>
<td><code>s3:ListBucket</code></td>
<td>Allows GitLab to list objects in the bucket.</td>
</tr>
<tr>
<td><code>s3:PutObject</code></td>
<td>Allows GitLab to upload files to the bucket.</td>
</tr>
<tr>
<td><code>s3:DeleteObject</code></td>
<td>Allows GitLab to delete objects when synchronizing files with the <code>--delete</code> option.</td>
</tr>
</tbody></table>
<h2 id="heading-step-8-configure-gitlab-cicd-variables">Step 8: Configure GitLab CI/CD Variables</h2>
<p>Now that you've created your IAM role and attached the required S3 permissions, let's move to GitLab.</p>
<p>You need to provide GitLab with the IAM Role ARN so that your CI/CD pipeline can use it to authenticate with AWS through OIDC.</p>
<p>To do this, open your GitLab repository and, from the left navigation panel, click Settings. Select CI/CD.</p>
<p>Expand the Variables section and click Add variable.</p>
<img src="https://cdn.hashnode.com/uploads/covers/609ec473b684eb4cd52c74a3/22474bde-3c8a-47b8-999f-58e81fb68653.gif" alt="Heading over to gitlab to put in our environmental variable " style="display: block;" width="1852" height="1018" loading="lazy">

<h2 id="heading-step-9-create-the-gitlab-cicd-pipeline">Step 9: Create the GitLab CI/CD Pipeline</h2>
<p>Now that you've configured GitLab CI/CD variables and created your IAM role, it's time to create the pipeline that automates deployment to Amazon S3.</p>
<p>GitLab uses a file called <code>.gitlab-ci.yml</code> to define the jobs and instructions that should run whenever changes are pushed to the repository.</p>
<p>For this tutorial, your pipeline will:</p>
<ul>
<li>Authenticate with AWS using OIDC.</li>
<li>Obtain temporary AWS credentials.</li>
<li>Upload our website files to the S3 bucket.</li>
<li>Synchronise changes whenever we push new updates.</li>
</ul>
<p>Here's an example repository:</p>
<pre><code class="language-plaintext">Ijaylab/practice-action-aws
</code></pre>
<p>Click the + icon to create a new file, or go to the Policy editor and your CI/CD code. Name the file <code>.gitlab-ci.yml</code> and add the following configuration:</p>
<pre><code class="language-plaintext">deploy_to_s3:
  stage: deploy

  image: ubuntu:latest

  id_tokens:
    GITLAB_OIDC_TOKEN:
      aud: sts.amazonaws.com

  before_script:
    - apt-get update
    - apt-get install -y curl unzip jq
    - curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
    - unzip awscliv2.zip
    - ./aws/install

  script:
    - export AWS_WEB_IDENTITY_TOKEN_FILE="/tmp/web-identity-token"
    - echo "$GITLAB_OIDC_TOKEN" &gt; "$AWS_WEB_IDENTITY_TOKEN_FILE"
    - export AWS_ROLE_SESSION_NAME="GitLab-OIDC-Session"
    - export AWS_DEFAULT_REGION="us-east-1"
    - echo "$GITLAB_OIDC_TOKEN" | cut -d '.' -f2 | tr '_-' '/+' | base64 -d 2&gt;/dev/null | jq '{sub, aud}'
    - aws sts get-caller-identity
    - aws s3 sync . s3://gitlab-s3-deployment-demo-bucket --delete --exclude ".git/*" --exclude ".gitlab-ci.yml"

  rules:
    - if: '$CI_COMMIT_BRANCH == "main"'
</code></pre>
<p>So what's going on in this configuration?</p>
<ul>
<li>deploy_to_s3: Names the job.</li>
<li>stage: Defines the deployment stage.</li>
<li>image: Provides the Ubuntu environment.</li>
<li>id_tokens: Requests an OIDC token.</li>
<li>before_script: Installs AWS CLI and other tools.</li>
<li>script: Runs the deployment commands.</li>
<li>AWS_WEB_IDENTITY_TOKEN_FILE: Stores the OIDC token.</li>
<li>AWS_DEFAULT_REGION: Sets the AWS region.</li>
<li>aws sts get-caller-identity: Checks AWS authentication.</li>
<li>aws s3 sync: Uploads files to S3.</li>
<li>--delete: Removes outdated files.</li>
<li>--exclude: Skips files we don't need.</li>
<li>rules: Runs the job only on the main branch.</li>
</ul>
<p><strong>Important:</strong> Replace <code>YOUR_AWS_REGION</code> with the actual region where you created your S3 bucket, for example <code>eu-west-1</code> if that is your bucket's region.</p>
<p>This will trigger the GitLab pipeline.</p>
<h2 id="heading-step-10-verify-the-deployment-on-amazon-s3">Step 10: Verify the Deployment on Amazon S3</h2>
<p>Now that your GitLab pipeline has successfully authenticated with AWS, the next step is to confirm that your website files have been uploaded to your S3 bucket.</p>
<p>To do that, open the AWS Management Console and go to Amazon S3, then Buckets. Open your bucket: gitlab-s3-deployment-demo-bucket.</p>
<p>Then click the Objects tab, and check that your website files are there:</p>
<ul>
<li>index.html</li>
<li>error.html</li>
<li>style.css</li>
</ul>
<p>These are the files that we created and uploaded to GitLab earlier.</p>
<p>Then go to the Properties tab of your S3 bucket. Scroll down to Static website hosting, and copy the Bucket website endpoint. Then paste it into your browser. Your website should load.</p>
<img src="https://cdn.hashnode.com/uploads/covers/609ec473b684eb4cd52c74a3/d68a2b61-e0ee-4f0e-8673-e7471f23e380.gif" alt="testing the pipeline" style="display: block;" width="1920" height="1080" loading="lazy">

<h2 id="heading-step-11-re-testing-deployment">Step 11: Re-Testing Deployment</h2>
<p>To confirm that automation works, open index.html in your repository and make a small change to the index page.</p>
<p>Then go back to the AWS console and refresh your S3 website hosting endpoint. You should see your updated website without manually uploading the file to S3.</p>
<p>That's the automation we wanted to achieve. GitLab handles the deployment whenever you push changes to your repository.</p>
<img src="https://cdn.hashnode.com/uploads/covers/609ec473b684eb4cd52c74a3/bafc55ef-320c-404c-90ec-3d70f499c595.gif" alt="Making a change in our index.html file to see if it automatically works" style="display: block;" width="1852" height="1018" loading="lazy">

<h2 id="heading-step-12-test-the-error-page">Step 12: Test the Error Page</h2>
<p>Since you created an error.html file, let's confirm that it works on your S3 website.</p>
<p>Open your S3 bucket in the AWS Console and go to Properties. Then scroll down to Static website hosting and confirm that the Error document is set to error.html.</p>
<p>Next, copy your bucket website endpoint and open the endpoint in your browser and add a page that doesn't exist.</p>
<img src="https://cdn.hashnode.com/uploads/covers/609ec473b684eb4cd52c74a3/bede84c1-09bf-495e-be98-9d71365de285.gif" alt="still testing now the error page" style="display: block;" width="1852" height="1018" loading="lazy">

<p>You should see the custom error page you created.</p>
<p>Once you've confirmed that both your homepage and error page work, you can proceed to cleanup.</p>
<h2 id="heading-step-11-clean-up-your-aws-resources">Step 11: Clean Up Your AWS Resources</h2>
<p>Since this is a learning project, you may want to remove the resources when you're done to avoid unnecessary AWS charges.</p>
<p>To do that, empty your S3 bucket and delete it if you no longer need it (AWS will charge). You can also delete the IAM role if you no longer need it (optional, as AWS doesn't charge). Finally, delete the IAM identity provider if no other project uses it (optional, as AWS doesn't charge).</p>
<h2 id="heading-conclusion">Conclusion</h2>
<p>That’s it! You now have GitLab deploying your website files to Amazon S3 for you.</p>
<p>You no longer have to log in to AWS and upload your files by hand every time you make a change. Now you just push your changes to GitLab, and the pipeline does the upload. And because we used OIDC, you didn't have to save any AWS keys anywhere.</p>
<p>I hope this tutorial helped you set up your own pipeline. If you ran into an error, check the job log. That is how I found my own mistakes while writing this.</p>
<h3 id="heading-further-reading">Further Reading:</h3>
<ul>
<li><a href="https://www.freecodecamp.org/news/cloud-computing-guide-for-beginners/"><u>What is Cloud Computing? A Guide for Beginners</u></a></li>
<li><a href="https://www.freecodecamp.org/news/learn-cloud-security-fundamentals-in-aws-a-guide-for-beginners/"><u>How to Deploy a</u></a> <a href="https://www.freecodecamp.org/news/how-to-deploy-a-kubernetes-app-on-aws-eks/"><u>Kub</u></a><a href="https://github.com/ijayhub"><u>ernete</u></a><a href="https://twitter.com/ijaydimples"><u>s App o</u></a><a href="https://www.freecodecamp.org/news/how-to-deploy-a-kubernetes-app-on-aws-eks/"><u>n A</u></a><a href="https://twitter.com/ijaydimples"><u>WS EKS</u></a></li>
<li><a href="https://www.freecodecamp.org/news/best-aws-services-for-frontend-deployment/"><u>T</u></a><a href="https://github.com/ijayhub"><u>he Bes</u></a><a href="https://www.freecodecamp.org/news/best-aws-services-for-frontend-deployment/"><u>t AW</u></a><a href="https://twitter.com/ijaydimples"><u>S Servi</u></a><a href="https://www.freecodecamp.org/news/best-aws-services-for-frontend-deployment/"><u>ces</u></a> <a href="https://www.linkedin.com/in/ijeoma-igboagu/"><u>to Depl</u></a><a href="https://www.freecodecamp.org/news/best-aws-services-for-frontend-deployment/"><u>oy</u></a> <a href="https://www.freecodecamp.org/news/best-aws-services-for-frontend-deployment/"><u>Front-End Applications in 2025</u></a></li>
<li><a href="https://twitter.com/ijaydimples"><u>W</u></a><a href="https://www.freecodecamp.org/news/backend-as-a-service-beginners-guide/"><u>hat</u></a> <a href="https://twitter.com/ijaydimples"><u>is Back</u></a><a href="https://www.freecodecamp.org/news/backend-as-a-service-beginners-guide/"><u>end</u></a> <a href="https://github.com/ijayhub"><u>as a</u></a> <a href="https://www.freecodecamp.org/news/backend-as-a-service-beginners-guide/"><u>Service (BaaS)? A Beginner's Guide</u></a></li>
<li><a href="https://dev.to/ijay/the-hidden-challenges-of-building-with-aws-8mg"><u>The Hidden Challenges of Building with AWS</u></a></li>
</ul>
<p>If you found this article helpful, feel free to share it.</p>
<p>I also build tools for people in tech. One of my recent projects is&nbsp;<a href="https://submitready.cloud/">SubmitReady,</a>&nbsp;which helps people prepare their AWS Community Builders applications. Whether you are a developer, technical writer, developer advocate, community manager, or work in another area of tech, you can use it to review your application and identify where you can make improvements.</p>
<p>If you prefer learning through videos, I also explain cloud and DevOps topics in simple terms on my&nbsp;<a href="https://www.youtube.com/@cloudinreallife">YouTube channel</a>.</p>
<p>You can also follow me on&nbsp;<a href="https://twitter.com/ijaydimples">Twitter</a>,&nbsp;<a href="https://www.linkedin.com/in/ijeoma-igboagu/">LinkedIn</a>&nbsp;and&nbsp;<a href="https://github.com/ijayhub">GitHub</a>.</p>
<p>Thank you for reading!</p>
 ]]>
                </content:encoded>
            </item>
        
    </channel>
</rss>
