Skip to content

AWS IAM Identity and Access Management interface for Julia

License

Notifications You must be signed in to change notification settings

samoconnor/AWSIAM.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 

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

License

Stars

Watchers

Forks

Packages

No packages published

Languages