Question: I have an array of objects:

```
this.array = [{name: null}, {name: null}, {name: null}]

```

and array of reservend names:

```
this.reserved = ["name2", "name3"]

```

I loop through array and try to set uniques name (not included inside `reserved` array)

```
  for (let i = 0; i < array.length; i++) {
    this.setDefaultName(array[i], 1);
  }

  private setDefaultName(obj, index){
    if (!this.reserved.includes(`name${index}`)) {
      obj.name = `name${index}`;
      this.reserved.push(`name${index}`);
    } else {
      return this.setDefaultName(obj, index + 1);
    }
  }

```

After that all objects from array have name "name3". The expected result is to have sequence unique name: "name1", "name4", "name5".
Could anyone help me?

Answer: 
Make sure to select an ami for Ubuntu and not Debian and that your aws account is subscribed to it

What I did

1. subscribe in aws marketplace to a Ubuntu Amazon Image (Ubuntu 20.04 LTS - Focal)
2. select launch instance, choose the region, and copy the ami shown
As Moritz pointed out:

Adding:

```
MachineOptions = [

  "amazonec2-ami=ami-02584c1c9d05efa69",
]

```

solves the issue.