Eniayomi
Eniayomi

Reputation: 103

How do i create an IAM user with s3 permission using cloudformation?

I need to create an IAM user with s3 permissions using cloudformation.

I havent found a solution

Upvotes: 5

Views: 3195

Answers (2)

krunal shimpi
krunal shimpi

Reputation: 1

You can try https:krunal4amity.github.io . It is an online aws cloudformation template generator. It takes away a lot of manual work and time required to generate templates.

Upvotes: -3

John Rotenstein
John Rotenstein

Reputation: 269091

Use AWS::IAM::User to create the IAM User.

Here's a YAML template that uses Managed Policies:

  DeveloperUser:
    Type: 'AWS::IAM::User'
    Properties:
      UserName: user-developer
      ManagedPolicyArns:
        - 'arn:aws:iam::aws:policy/AWSServiceCatalogEndUserFullAccess'
        - 'arn:aws:iam::aws:policy/ReadOnlyAccess'
        - 'arn:aws:iam::aws:policy/CloudWatchFullAccess'
        - 'arn:aws:iam::aws:policy/AmazonVPCFullAccess'
        - 'arn:aws:iam::aws:policy/AmazonS3FullAccess'

Here's a JSON policy that has inline permissions:

      "User":{
         "Type":"AWS::IAM::User",
         "Properties":{
            "Policies":[
               {
                  "PolicyName":"S3",
                  "PolicyDocument":{
                     "Statement":[
                        {
                           "Effect":"Allow",
                           "Action":[
                              "s3:*",
                           ],
                           "Resource":[
                              "arn:aws:s3:::my-bucket",
                              "arn:aws:s3:::my-bucket/*"
                           ]
                        }
                     ]
                  }
               }
            ]
         }
      }

Upvotes: 7

Related Questions