How do I define the principal for an AWS policy statement?

0 votes

I started from http://awspolicygen.s3.amazonaws.com/policygen.html in order to create a policy that will grant upload rights to a specific S3 bucket for a list of users.
I'm not clear on how I define who those users should be.

The docs refer to a principal as "a person or persons" without an example of how to refer to said person(s). One assumes "email address" and the policy generator will accept it, but when I paste the generated statement to the bucket policy editor, I get:

Invalid principal in policy - "AWS" : "geek@here.com"

Full statement:

{
  "Id": "myPol",
  "Statement": [
    {
      "Sid": "Stmt130",
      "Action": "s3:*",
      "Effect": "Allow",
      "Resource": "arn:aws:s3:::myBucketName",
      "Principal": {
        "AWS": [
          "steve@here.com"
        ]
      }
    } ]
}
Jun 25, 2018 in AWS by Flying geek
• 3,130 points

edited Jun 26, 2018 by Flying geek 53 views

2 answers to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes
Please help me in this  ASAP, anyone?
answered Jun 25, 2018 by Flying geek
• 3,130 points
0 votes

Check with AWS Policy Documentations once, rest you can try this code if it doesn't work then feel free to reach me, cheers:  

Code:

[HttpPost]
public ActionResult Uploaddemo(HttpPostedFileBase file) {
    try {
        IAmazonS3 client;
        using (client = Amazon.AWSClientFactory.CreateAmazonS3Client(_awsAccessKey, _awsSecretKey,RegionEndpoint.USWest2)) {
            var request = new PutObjectRequest() {
                BucketName = _bucketName,
                CannedACL = S3CannedACL.PublicRead, ACCESIBLE
                Key = string.Format("visumes/{0}", file.FileName),
                InputStream = file.InputStream,//SEND THE FILE STREAM
            };

            Amazon.S3.AmazonS3Config s3Config = new Amazon.S3.AmazonS3Config() { 
                ServiceURL = "http://s3.amazonaws.com"  
            };
            string HOST ="http://s3-website-us-west-2.amazonaws.com";
            client.PutObject(request);
        }
    } catch (Exception ex) {

    }
    return View();
}
answered Jun 25, 2018 by Cloud gunner
• 4,240 points

edited Jun 26, 2018 by Cloud gunner

Related Questions In AWS

0 votes
1 answer
0 votes
1 answer

How do I add python libraries to an AWS lambda function for Alexa?

As it is described in the Amazon ...READ MORE

answered Oct 23, 2018 in AWS by Archana
• 3,770 points
80 views
0 votes
1 answer
+1 vote
2 answers

AWS CloudWatch Logs in Docker

The awslogs works without using ECS. you need to configure ...READ MORE

answered Sep 6, 2018 in AWS by bug_seeker
• 14,960 points
229 views
0 votes
1 answer

Deploy Docker Containers from Docker Cloud

To solve this problem, I followed advice ...READ MORE

answered Sep 3, 2018 in AWS by Priyaj
• 56,100 points
56 views
+1 vote
4 answers

How do I cache my images which are stored in Amazon S3?

when caching ec2 instance these can be ...READ MORE

answered Oct 23, 2018 in AWS by Nabarupa
257 views
0 votes
1 answer

AWS Cloudtrail API for Go SDK showing an error mesage.

You  must add S3 Policy in your ...READ MORE

answered Jun 27, 2018 in AWS by Flying geek
• 3,130 points
91 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.