Skip to content

Instantly share code, notes, and snippets.

@xli
Last active August 29, 2015 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xli/fbb38b5974f6ea3a17a3 to your computer and use it in GitHub Desktop.
Save xli/fbb38b5974f6ea3a17a3 to your computer and use it in GitHub Desktop.
Create user and credentials for S3 multipart upload, output credentials for later configuration
"S3UploadUser" : {
"Type" : "AWS::IAM::User",
"Properties" : {
"Path" : "/",
"Policies" : [ {
"PolicyName" : "S3MultipartUpload",
"PolicyDocument" : {
"Version": "2012-10-17",
"Statement" : [ {
"Effect" : "Allow",
"Action" : [ "s3:PutObject", "s3:GetObject", "s3:AbortMultipartUpload", "s3:ListMultipartUploadParts", "s3:ListBucketMultipartUploads" ],
"Resource" : [
{ "Fn::Join" : [ "", ["arn:aws:s3:::", { "Ref" : "UploadBucketName" }, "/*"]]}
]
}]
}
}]
}
},
"S3UploadKey" : {
"Type" : "AWS::IAM::AccessKey",
"Properties" : {
"Status": "Active",
"UserName" : { "Ref" : "S3UploadUser" }
}
}
.................
// Outputs for EC2 instances:
"S3UploadAccessKeyId": {
"Description": "Access key id for S3 upload",
"Value": { "Ref" : "S3UploadKey" }
},
"S3UploadSecretKey": {
"Description": "Secret key for S3 upload",
"Value" : { "Fn::GetAtt" : [ "S3UploadKey", "SecretAccessKey" ] }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment