title: Accessing the AWS S3 from on-premise world through Direct Connect, VPC and VPC Endpoint using AWS SDK
body: <p>Our setup:  </p>
  
  <ul>
  <li>we have a server on-premise, from which we want to send data to S3 (using AWS Java SDK)</li>
  <li>our on-premise data center is connected to AWS using Direct Connect</li>
  <li>on the AWS side, there is a VPC which does have a VPC Endpoint to S3</li>
  </ul>
  
  <p><a href="https://i.stack.imgur.com/3t5EI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3t5EI.png" alt="enter image description here"></a></p>
  
  <p>Our assumption is that everything is routed properly (on-premise can see the VPC in AWS). Let's assume VPC CIDR range is 10.10.10.0/24.</p>
  
  <p>When we call the "PutObject" (but can be any S3 method) in the SDK and give the name of our bucket, the resulting request from SDK is targeting a public S3 IP address (52.xxx). However, this won't be routed as: Direct Connect -> VPC -> VPC Endpoint -> S3, instead, our routers will route the traffic to the internet proxy (as a default 0.0.0.0/0 route) - because the VPC CIDR range is 10.10.10.0/24. </p>
  
  <p><strong>My question is</strong> (obviously): is there <strong>a right way how to route the traffic through the AWS Direct Connect and not through the internet</strong>? </p>
  
  <p>I am hoping for something like:</p>
  
  <ul>
  <li>there is an option in the SDK command to include additional IP to
  which the request should be sent first </li>
  <li>there is some S3 on-premise
  service which we can spin-up </li>
  <li>there is a simple button in some of the
  involved services which can be pressed.</li>
  </ul>
  
  <p><strong>Disclaimer:</strong> I am not really a networking or AWS infra master, so excuse some of my vagueness.</p>