title: Terraform: what does AssumeRole: Service: ec2 do?
body: <p>What exactly does this AWS role do?</p>
  
  <p>The most relevant bits seem to be: 
  <code>"Action": "sts:AssumeRole",</code> and 
  <code>"Service": "ec2.amazonaws.com"</code></p>
  
  <p>The full role is here:</p>
  
  <pre><code>resource "aws_iam_role" "test_role" {
    name = "test_role"
  
    assume_role_policy = &lt;&lt;EOF
  {
    "Version": "2012-10-17",
    "Statement": [
      {
        "Action": "sts:AssumeRole",
        "Principal": {
          "Service": "ec2.amazonaws.com"
        },
        "Effect": "Allow",
        "Sid": ""
      }
    ]
  }
  EOF
  }
  </code></pre>
  
  <p>From: <a href="https://www.terraform.io/docs/providers/aws/r/iam_role.html" rel="noreferrer">https://www.terraform.io/docs/providers/aws/r/iam_role.html</a></p>