mirror of
https://github.com/floci-io/floci.git
synced 2026-11-30 08:55:17 -05:00
Under IAM enforcement, a request that handed Auto Scaling a role needed no iam:PassRole on it. A user allowed only the Auto Scaling actions could create a group from a launch template whose instance profile holds any role in the account, and Floci launches the group's instances with that profile, so they got the role's credentials. The IAM user guide requires the permission for every role passed to a service, and the EC2 Auto Scaling user guide lists where these operations pass one: - CreateLaunchConfiguration passes the roles of its IamInstanceProfile, given by name or ARN, or else of the profile of the instance it is made from, which the configuration copies, to ec2.amazonaws.com. - CreateAutoScalingGroup and UpdateAutoScalingGroup pass the roles of the instance profile in each launch template they name, at the version the group launches from, there too: the permission is "needed on the IAM identity (user or role) that creates or updates an Auto Scaling group using a launch template that specifies an instance profile". That covers the group's own template, its mixed instances policy's and each override's. StartInstanceRefresh does the same for its desired configuration, read merged with the group as Auto Scaling applies it: a version named alone moves the group's own template to it, and a template named alone keeps the group's version. - A ServiceLinkedRoleARN other than the default AWSServiceRoleForAutoScaling, and a lifecycle hook's RoleARN (PutLifecycleHook, and the hooks CreateAutoScalingGroup names), go to autoscaling.amazonaws.com. The guide asks for the permission "when a nondefault service-linked role, an IAM role for a lifecycle hook, or a launch template that specifies an instance profile ... is provided". - Application Auto Scaling's RegisterScalableTarget passes RoleARN to application-autoscaling.amazonaws.com when the request names one. A group from a launch configuration passes nothing, since the configuration's role was checked when it was created. Launching an EC2 instance straight from a launch template is unchanged: the EC2 user guide has that role checked where the template is made. The launch template version, a source instance's profile and a refresh's merged template are looked up through PassedRoleLookup, which the Auto Scaling service now implements with the code its own operations use, so the filter does not depend on Auto Scaling.