Auto Attaching elastic Ip to self hosted ec2 runner

Hi GitHub team ,

I am currently working on self hosted ec2 runner .
origin repo : GitHub - machulav/ec2-github-runner: On-demand self-hosted AWS EC2 runner for GitHub Actions

My question is how to attach automatic elastic ip after successful instance creation using this method ? Any insight would be appreciated .

yml template using :
name: do-the-job
on: pull_request
jobs:
start-runner:
name: Start self-hosted EC2 runner
runs-on: ubuntu-latest
outputs:
label: {{ steps.start-ec2-runner.outputs.label }} ec2-instance-id: {{ steps.start-ec2-runner.outputs.ec2-instance-id }}
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: {{ secrets.AWS_ACCESS_KEY_ID }} aws-secret-access-key: {{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: {{ secrets.AWS_REGION }} - name: Start EC2 runner id: start-ec2-runner uses: machulav/ec2-github-runner@v2.1.0 with: mode: start github-token: {{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
ec2-image-id: ami-123
ec2-instance-type: t3.nano
subnet-id: subnet-123
security-group-id: sg-123
iam-role-name: my-role-name # optional, requires additional permissions
aws-resource-tags: > # optional, requires additional permissions
[
{“Key”: “Name”, “Value”: “ec2-github-runner”},
{“Key”: “GitHubRepository”, “Value”: “${{ github.repository }}”}
]

Note :

  1. I want to establish the EIP connection here in ‘- name: Start EC2 runner’ step ,but as per the syntactical limitation i am not able to use ‘run’ keyword here as it says 'run ’ can not be used with ‘uses’ and ‘with’ .

  2. Then i used the EIP association aws command with in another step by giving it another name , but in that case facing a time put error in previous start runner step where the ec2 instance was seeking for internet connection .

Need assistance here @Volodymyr Machula
@githubactions