title: restrict access to s3 bucket only to specific ec2 instances
body: <p>I have generated the below policy but it still allows all other ec2 instances to access my bucket. what change should I make to this policy? what I want is my bucket to be accessible only to the instance I have mentioned and not to any other instance</p>
  
  <pre><code>{
    "Id": "Policy1507871740101",
    "Version": "2012-10-17",
    "Statement": [
      {
        "Sid": "Stmt1507871738318",
        "Action": "s3:*",
        "Effect": "Allow",
        "Resource": "arn:aws:s3:::bucket/*,
        "Principal": {
          "AWS":"arn:aws:ec2:region:userid:instance/instanceid"
        }
      }
    ]
  }
  </code></pre>