JavaScript SDK - Prefix list version required to modify entry despite not being a required parameter

0

According to the JavaScript aws-sdk documentation, the version number of a managed prefix list is not a required parameter when modifying an entry.

However, when I attempt to do so, I hit a MissingParameter: A prefix list version is required error.

If I set the CurrentVersion parameter to the version of the prefix list, I am able to update the entry. However, this information is not provided when calling describeManagedPrefixLists so I have to manually locate the version number in the console and update my code for it to work.

Is there a way to locate the current version number programmatically, or get past the prefix list version being a required field?

const modifyEntryParams = {
  PrefixListId: currentPrefixListID,
  CurrentVersion: 289,
  AddEntries: [{
    Cidr: currentIP,
    Description: name
  }]
}
ec2.modifyManagedPrefixList(modifyEntryParams, function(err, data) {
  if (err) console.log(err, err.stack);
  else     console.log("modify success",data);
});
feita há 2 anos377 visualizações
1 Resposta
0
Resposta aceita

When calling describeManagedPrefixLists the current version is returned in the field Version of the response. See sample output below:

{
  PrefixLists: [
    {
      PrefixListId: 'pl-0df3d7438f3xxxxxx',
      AddressFamily: 'IPv4',
      State: 'modify-complete',
      PrefixListArn: 'arn:aws:ec2:eu-west-1:123456789012:prefix-list/pl-0df3d7438f3xxxxxx',
      PrefixListName: 'my-list',
      MaxEntries: 100,
      Version: 2,
      Tags: [],
      OwnerId: '123456789012'
    }
  ]
}
AWS
ESPECIALISTA
respondido há 2 anos
  • Ah, I was just looking in the wrong place. Lists that don't have version return nothing instead of Version: 0. Thanks for the help. Do you know why the version number is required in the first place?

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.

Diretrizes para responder a perguntas