Skip to content

Latest commit

 

History

63 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AWSIAM

AWS IAM Interface for Julia

Build Status

using AWSIAM

aws = AWSCore.aws_config()

println(iam_whoami(aws))

creds = iam_create_user(aws, "my_user")


@protected try

    iam(aws, Action = "CreateRole",
             Path = "/",
             RoleName = name,
             AssumeRolePolicyDocument = """{
                "Version": "2012-10-17",
                "Statement": [ {
                    "Effect": "Allow",
                    "Principal": {
                        "Service": "ec2.amazonaws.com"
                    },
                    "Action": "sts:AssumeRole"
                } ]
             }""")

catch e
    @ignore if e.code == "EntityAlreadyExists" end
end

iam(aws, Action = "PutRolePolicy",
         RoleName = name,
         PolicyName = name,
         PolicyDocument = Policy)

@protected try 

    iam(aws, Action = "CreateInstanceProfile",
             InstanceProfileName = name,
             Path = "/")
catch e
    @ignore if e.code == "EntityAlreadyExists" end
end


@repeat 2 try 

    iam(aws, Action = "AddRoleToInstanceProfile",
             InstanceProfileName = name,
             RoleName = name)

catch e
    @retry if e.code == "LimitExceeded"
        iam(aws, Action = "RemoveRoleFromInstanceProfile",
                 InstanceProfileName = name,
                 RoleName = name)
    end
end

About

AWS IAM Identity and Access Management interface for Julia

Resources

Stars

1 star

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages