Search code examples
amazon-web-servicesdockerdocker-swarmdocker-cloud

connecting Docker to a cloud provider, Amazon AWS


Context: I was going though Link to Amazon Web Services to create Swarms, in order to connect to my provider.

The role was created with success.

Then, while creating the policy, to associate to the role, a problem happened.

Problem: An error occurred: Cannot exceed quota for PolicySize: 5120

docker-amazon

As suggested by them, this is what I need to add in policy:

https://docs.docker.com/docker-for-aws/iam-permissions/

Did some research and people seem to like this solution:

https://github.com/docker/machine/issues/1655

How can I create the policy using the best method? Noticing that the documentation in Docker is wrong - doesn't work in my case - what's the best method?


Solution

  • You are looking at the wrong instructions to connect docker-cloud to AWS follow these instructions: https://docs.docker.com/docker-cloud/infrastructure/link-aws/

    It's the following 3 steps

    1. Create AWS Policy for docker-cloud
    2. Create a docker-cloud role and attache the policy from 1
    3. Attach AWS role/account to docker-cloud

    The policy in (1) above is pretty simple. It should be allowed to perform ec2 instances related actions (your screenshot of the policy looks like it doesn't provide ec2 permissions):

    {
      "Version": "2012-10-17",
      "Statement": [
        {
          "Action": [
            "ec2:*",
            "iam:ListInstanceProfiles"
          ],
          "Effect": "Allow",
          "Resource": "*"
        }
      ]
    }
    

    The role must have the permissions to implement the policy.

    For a detailed post on the deployment via docker-cloud see: https://blog.geografia.com.au/how-we-are-using-docker-cloud-for-automated-testing-and-deployments-of-applications-bb87ec3173e7