Skip to content

tnhkoc/EC2-to-S3-IAM-Role-Integration

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 

Repository files navigation

EC2 to S3 IAM Role Integration

Secure, secret-less AWS service communication using IAM Roles.

🎯 Objective

This project demonstrates the best practice for granting an EC2 instance access to an S3 bucket without using hardcoded credentials, leveraging IAM instance profiles.

🚀 Key Features

  • IAM Instance Profiles: Attach permissions directly to compute resources.
  • Apache Setup: Basic web server configuration on the EC2 instance.
  • AWS CLI Usage: Practical examples of interacting with S3 from the command line.

🏗️ Architecture

flowchart LR
  EC2["EC2 Instance (Apache)"] -->|Assume Role| Role["IAM Role"]
  Role -->|Permit Access| S3["S3 Bucket"]
Loading

📁 Project Structure

.
├── index.html      # Sample web content
├── screenshots/    # Visual guide for IAM and instance setup
└── README.md       # Project documentation

🛠️ Tech Stack

  • Cloud: AWS (EC2, S3, IAM)
  • Web Server: Apache (HTTPD)
  • Tooling: AWS CLI

🔧 Setup & Steps

1. Launch EC2 Instance

Configure a basic EC2 instance (Amazon Linux 2023). EC2 Details

2. Connect & Install Apache

SSH into the instance and install the web server. SSH Connection Apache Install

3. Start Web Service

Start Apache Verify the web server is reachable via the public IP. Browser Output

4. Configure IAM Role

Create an IAM Role with S3ReadOnlyAccess policy. IAM Role Details

5. Attach Role to EC2

Attach the created IAM instance profile to your running EC2 instance. Attach Role

✅ Verification

Use the AWS CLI on the instance to list files from S3 without providing manual keys. S3 Listing


Created by Tunahan Koç | LinkedIn | GitHub

About

Simple EC2 project demonstrating Apache setup and IAM Role-based access to S3 using AWS CLI.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages