DEV Community

James Kipsoi
James Kipsoi

Posted on

Deploying Your First Server with Terraform: A Beginner's Guide

Deploying Your First Server with Terraform: A Beginner's Guide

Hi there,

There is nothing quite as satisfying as deploying your first server… and somehow it feels even better when using Terraform as your Infrastructure as Code platform.

There is this strange surge of dopamine that hits you the moment you press Enter and watch your creation come to life.

Especially when exploring a completely new concept.

For me, one of those moments was experimenting with AWS S3 Presigned URLs while running everything from an EC2 instance.

And honestly? Seeing it work felt slightly illegal.


AWS S3 Presigned URL Demo

This project demonstrates how to securely generate Presigned URLs for Amazon S3 uploads using an EC2 instance.

Key Concepts Learned

Security

Instead of hardcoding AWS Access Keys like a future security incident waiting to happen, the project uses AWS IAM Roles (Instance Profiles).

Regional Compliance

AWS regions can become surprisingly annoying if configured incorrectly.
This project correctly handles regions such as eu-north-1 using boto3 configuration with Signature Version 4 enforcement.

Presigned URLs

Presigned URLs allow clients to upload files directly to S3 without needing permanent AWS credentials.

Which is honestly one of those “wait… this is actually genius” cloud moments.


Prerequisites

Before running the project, I needed:

  • An active AWS account
  • An S3 bucket
  • An EC2 instance running Amazon Linux 2023
  • Mild patience and stable internet

Quick Start

1. Clone the Repository

git clone https://github.com/jameskipngetich/s3-uploader-demo.git
cd s3-uploader-demo
Enter fullscreen mode Exit fullscreen mode

2. Install Dependencies

pip3 install boto3 requests
Enter fullscreen mode Exit fullscreen mode

3. Run the Upload Demo

# Syntax:
python3 main.py <BUCKET_NAME> <FILE_TO_UPLOAD> <ACTION>

# Example:
echo "Hello S3" > test.txt
python3 main.py my-demo-bucket-123 test.txt put
Enter fullscreen mode Exit fullscreen mode

Final Thoughts

One thing I am slowly learning is that cloud engineering becomes much less scary once you stop avoiding documentation.

Most debugging sessions are honestly just:

  • misunderstanding regions,
  • permissions,
  • or forgetting one tiny configuration somewhere.

Reading the docs makes debugging almost obsolete.

Almost.

Peace.

— lelkiramkeel

Top comments (0)