Reputation: 103
I need to create an IAM user with s3 permissions using cloudformation.
I havent found a solution
Upvotes: 5
Views: 3195
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
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