通过AWS中的PowerShell生成多个API密钥

问题描述 投票:0回答:1

我想通过脚本以编程方式在AWS中为我的REST API创建API密钥。

response = client.create_api_key(
  name='string',
  description='string',
  enabled=True|False,
  generateDistinctId=True|False,
  value='string',
  stageKeys=[
      {
          'restApiId': 'string',
          'stageName': 'string'
      },
  ],
  customerId='string'
)

我找到了这个方法,并希望脚本看起来像这样。有谁知道我是如何成功创建API密钥的?

要使用CLI执行此操作我使用了它,它工作正常:

 aws apigateway create-api-key --name 'WH1-In4m-ApiKey' --description 'development.' --enabled --stage-keys restApiId='yz50sp19a7',stageName='wh1'

如何在powershell中复制aws?

powershell amazon-web-services aws-api-gateway
1个回答
2
投票

如果您正确配置了AWS凭证,则可以使用:

  1. 脚本中的AWS CLI(如果已安装AWS CLI)生成API密钥:create-api-key
  2. 使用Python Boto3库:create-api-key

您可能必须为选项#1安装AWS Tools for Windows PowerShell

© www.soinside.com 2019 - 2024. All rights reserved.