title: EC2 Instance profile to access DynamoDB
body: <p>I want to use ec2 instance profile to allow my python program to access a DynamoDb table. I have tested a policy by directly assigning to the user. Now I assign this same policy as a Instance Profile to ec2 instance where my job is running. 
  This is the policy.</p>
  
  <pre><code>{
  "Version": "2012-10-17",
  "Statement": [
      {
          "Effect": "Allow",
          "Action": [
              "dynamodb:*"
          ],
          "Resource": "arn:aws:dynamodb:us-east-2:913580688765:table/users"
      }
  ]
  }
  </code></pre>
  
  <p>Additionally I assigned a policy to the user to be able to Pass the ec2 role.</p>
  
  <pre><code>{
  "Version": "2012-10-17",
  "Statement": [
      {
          "Effect": "Allow",
          "Action": [
              "ec2:AssociateIamInstanceProfile",
              "ec2:ReplaceIamInstanceProfileAssociation"
          ],
          "Resource": "*"
      },
      {
          "Effect": "Allow",
          "Action": "ec2:DescribeIamInstanceProfileAssociations",
          "Resource": "*"
      },
      {
          "Effect": "Allow",
          "Action": "iam:PassRole",
          "Resource": "*"
      }
  ]
  }
  </code></pre>
  
  <p>But this does not work.
  What am I missing here? </p>