Created
September 19, 2018 11:00
-
-
Save favio41/149c0d069db7695b660f8385abeaa0f3 to your computer and use it in GitHub Desktop.
AWS cloudformation user creation with programmatic access and s3 policy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AWSTemplateFormatVersion: '2010-09-09' | |
Resources: | |
# Setup an user | |
user: | |
Type: AWS::IAM::User | |
Properties: | |
UserName: !Join | |
- '-' | |
- - 'changeme' | |
- !Ref 'AWS::Region' | |
Policies: | |
- PolicyName: bucket-access | |
PolicyDocument: | |
Version: '2012-10-17' | |
Statement: | |
- Effect: Allow | |
Action: | |
- s3:GetObject | |
Resource: arn:aws:s3:::/* | |
userAccesskey: | |
Type: AWS::IAM::AccessKey | |
Properties: | |
UserName: | |
!Ref user | |
Outputs: | |
AccessKeyUser: | |
Value: | |
!Ref userAccesskey | |
# will print first time on output variables the password. | |
SecretKeyUser: | |
Value: !GetAtt userAccesskey.SecretAccessKey |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment