Skip to content

Make AMI Name retrieval automatic #266

@ZainRizvi

Description

@ZainRizvi

JIRA: https://lf-pytorch.atlassian.net/browse/PC-31

Today, we tell users which AMI their job is running on by hard coding the list of known AMI IDs to AMI names. This of course will break every time the AMI is updated.

Instead, there's a command that can pull the AMI name from AWS, but it requires certain permissions to be set. Here's the command an the error it gets today:

[root@ip-10-0-19-56 runner-scripts]# AMI_ID="ami-0ce0c36d7a00b20e2"
[root@ip-10-0-19-56 runner-scripts]# AMI_NAME=$(aws ec2 describe-images --image-ids $AMI_ID --query 'Images[0].Name' --output text)

An error occurred (UnauthorizedOperation) when calling the DescribeImages operation: You are not authorized to perform this operation. User: arn:aws:sts::308535385114:assumed-role/gh-ci-github-action-runners-runner-role/i-076101f9e5b2c54e3 is not authorized to perform: ec2:DescribeImages because no identity-based policy allows the ec2:DescribeImages action

The ask:

  1. Grant runners the permission needed to invoke the above command
  2. Modify the setup script to actually use the above command

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions