# Securing the Connection to S3 from EC2

DevFeed: [Securing the Connection to S3 from EC2](<https://devfeed.tech/articles/securing-the-connection-to-s3-from-ec2-18012.md>)

Original publisher: [Read original article](<https://blog.guilleojeda.com/ec2-s3-vpc-endpoint-security>)

Author: Guillermo Ojeda

Published: 2023-09-07T15:02:09Z

Content type: tutorial

Language: en

Sources: [Guille Ojeda](<https://devfeed.tech/sources/guille-ojeda.md>)

Topics: [Amazon EC2](<https://devfeed.tech/topics/amazon-ec2.md>), [Amazon S3](<https://devfeed.tech/topics/amazon-s3.md>), [VPC](<https://devfeed.tech/topics/vpc.md>), [Security](<https://devfeed.tech/topics/security.md>), [AWS CloudFormation](<https://devfeed.tech/topics/aws-cloudformation.md>)

Tags: [amazon-vpc](<https://devfeed.tech/tags/amazon-vpc.md>), [aws](<https://devfeed.tech/tags/aws.md>), [cloud](<https://devfeed.tech/tags/cloud.md>), [cloudformation](<https://devfeed.tech/tags/cloudformation.md>), [ec2](<https://devfeed.tech/tags/ec2.md>), [s3](<https://devfeed.tech/tags/s3.md>), [security](<https://devfeed.tech/tags/security.md>)

## AI overview

A step-by-step tutorial for securing access from an Amazon EC2 instance to a private object in Amazon S3. It explains how to replace a public bucket setup with a restrictive bucket policy and a VPC endpoint policy.

## Source excerpt

You've deployed your app on an EC2 instance, and there's a file in an S3 bucket that you need to access from the app. You created a public S3 bucket and uploaded the file, and it works! But then you read somewhere that keeping your private files in a...