Auto Scaling
User Guide

Launch Auto Scaling Instances with an IAM Role

AWS Identity and Access Management (IAM) roles for EC2 instances make it easier for you to access other AWS services securely from within the EC2 instances. EC2 instances launched with an IAM role automatically have AWS security credentials available.

You can use IAM roles with Auto Scaling to automatically enable applications running on your EC2 instances to securely access other AWS resources.

To launch EC2 instances with an IAM role in Auto Scaling, you'll have to create an Auto Scaling launch configuration with an EC2 instance profile. An instance profile is simply a container for an IAM role. First, create an IAM role that has all the permissions required to access the AWS resources, then add your role to the instance profile.

For more information about IAM roles and instance profiles, see IAM Roles in the IAM User Guide.


Create an IAM role for your EC2 instances. The console creates an instance profile with the same name as the IAM role. For more information, see Creating an IAM Role Using the Console in the Amazon EC2 User Guide for Linux Instances.

Create a Launch Configuration

When you create the launch configuration, specify the name of the instance profile or the full ARN of the instance profile.

For example, use the following create-launch-configuration command:

aws autoscaling create-launch-configuration --launch-configuration-name my-lc-with-instance-profile --image-id ami-baba68d3 --instance-type m1.small --iam-instance-profile my-instance-profile

Create an Auto Scaling Group

Create your Auto Scaling group, specifying the launch configuration that you just created.

For example, use the following create-auto-scaling-group command:

aws autoscaling create-auto-scaling-group --auto-scaling-group-name my-asg-with-instance-profile --launch-configuration-name my-lc-with-instance-profile --availability-zones "us-west-2c" --max-size 1 --min-size 1