Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Programmatically creating aws API key and adding it to a usage plan in single function?

I need to:

  1. Create API keys
  2. Add newly created API Keys to Usage Plans

Following the documentation, I can generate an API key by calling apigateway.createApiKey() and then can add usage plan for that generated api key by calling another function. apigateway.createUsagePlanKey() seems most appropriate function for later case.

Can I perform both the functionalities in single function rather than calling two functions separately like any function that generates a new API Key and adds it a usage plan as well?

like image 824
Adil Avatar asked Aug 23 '26 08:08

Adil


1 Answers

The ImportApiKeys API allows you to both create API Keys in bulk and attach the keys to Usage Plans in the same call.

Input is a CSV in the following format

Name,key,description,Enabled,usageplanIds
MyFirstApiKey,apikey1234abcdefghij0123456789,An imported key,TRUE,c7y23b
like image 112
jackko Avatar answered Aug 24 '26 23:08

jackko



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!