Accessing s3 bucket form Private Ec2 Instance

Phani PrasadPhani Prasad
1 min read

Project summary: In this step-by-step guide, we'll walk you through the process of creating a Virtual Private Cloud (VPC) on Amazon Web Services (AWS), configuring public and private subnets, and setting up a VPC endpoint to securely connect an EC2 instance from the private subnet to an S3 bucket.

Services being used: AWS EC2, VPC, VPC Endpoint and s3 bucket

Process flow:

  1. Creation of VPC

  2. Creation of Internet gateway and attaching to VPC

  3. Subnets creation (public and private subnet )

  4. NAT gateway creation

  5. Route table creation (public and private)

  6. Public route table associating with public subnet and should attach to internet gateway

  7. Private route table associating with private subnet and should attach to NAT gateway

  8. Deploying ec2 instances in public and private Make sure your private ec2 key should be in public ec2 instance

    1. chmod 400 <keypair name>

    2. ssh -i /path/to/private_key.pem ec2-user@private_ip_address

  9. Installing aws cli on private instance and configuring aws credentials

  10. Removing NAT gateway from private route-table

  11. Creation s3 bucket

  12. Creation of VPC endpoint associating with private route table

  13. Accessing s3 bucket from a private ec2 instance

0
Subscribe to my newsletter

Read articles from Phani Prasad directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Phani Prasad
Phani Prasad

Hi, I'm a seasoned DevOps engineer with over 4 years of experience in designing, implementing, and managing CI/CD pipelines. Proficient in cloud technologies such as AWS and Azure, I excels in automating infrastructure provisioning and configuration management using tools like Terraform and Ansible. With a strong background in both software development and system administration John effectively bridges the gap between development and operations teams, ensuring seamless integration and deployment of applications. I hold certifications in AWS Solutions Architect and Docker Certified Associate, showcasing his commitment to staying at the forefront of industry trends.