VPC-endpoint with S3 in AWS

Table of contents

In this article we connect s3 with vpc end point using ec2 instance running in private subnet.
First we have to create vpc in aws. In this vpc we have to create enter name of vpc like vpc-endpoint-demo and enter CIDR block range.
We have to create private network of 10.0.0.0/16.
In second step we have to create 4 subnet in 2 region. In first region create one public and one private subnet similarly in same as in another region.
In third step we have to create internet gateway for public connection and attached it with virtual private cloud after that attached this internet gateway with public subnet.
Forth step we have to create route table. we have to create two route table first for public subnet and second one is for private subnet.
Now we have two subnet one is public subnet and anothet one is private subnet. In both subnet we have to create ec2 instance.
Why we have to required two ec2 instance. we have use public instance for connecting private instance running in same vpc. demo server is use as jamp server is use for connection of private server.
This is private sever running in private subnet that why we have not access this server so how we connect s3 with server for this we have use vpc endpoint.
To connect s3 with vpc endpoint we have to create a i am user and create credential for access cli mode and also we gave permission to access s3 using user permission.
We have login into demo server it is private server we have connect this with public server like (sample server running on aws)
First we have to configure aws in this server i am using amazon linux ami so that we have no neet to setup aws cli in this server. To check you have aws cli step up on server you have to run aws —version command if output look like this
this means you have successfully configure aws
After that you have to configure aws for access your aws account for this you have run aws configure command on terminal and enter your credential.
To get credential you have to create user in IAM service and create access key.
Enter your name if you give management console access then you have to check this box other wise you don’t have required to click this option for cli mode.
Now press next button
In this you have attached policies give Administrator Access and move forward and press create user button.
In user move to security and credential section for create access key and create access key by press button use this key for aws cli now we have move to demo server and login into it.
Now you have to configure aws cli using this command.
aws configure.
Enter your credential key here and enter region or type of data show in format.
Now you have to run this command.
aws s3 ls
create a bucket in s3 and vpc-endpoint.
Enter name of your bucket and bucket name is unique because s3 is global service.
Similarly we have to create vpc endpoint in vpc section.
Enter your name of vpc endpoint and in service section enter s3 and select gateway and your VPC.
you don’t have need to create route for your vpc it automatically create and press endpoint button.
Now to have to run this command you will get the output.
You have successfully link your endpoint with s3 using private subnet.
If you have any issue regarding this blog you have mail me on below id or flow for such more interesting content comment.
if you interesting in this demo on you tube then comment me i will upload video.
Email- dhirendrataank97@gmail.com
Subscribe to my newsletter
Read articles from dhirendra directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
