Generate multiple API keys through powershell in AWS - powershell

I want to create API keys to my REST API in AWS programmatically through a script.
response = client.create_api_key(
name='string',
description='string',
enabled=True|False,
generateDistinctId=True|False,
value='string',
stageKeys=[
{
'restApiId': 'string',
'stageName': 'string'
},
],
customerId='string'
)
I found this method and am hoping the script should look something like this. Does anyone know how i successfully create the API keys?
To do this using CLI I used this and it works fine:
aws apigateway create-api-key --name 'WH1-In4m-ApiKey' --description 'development.' --enabled --stage-keys restApiId='yz50sp19a7',stageName='wh1'
How to replicate in powershell for aws?

If you have your AWS credentials correctly configured, you can use:
AWS CLI in your script (provided you have AWS CLI installed) to generate an API key: create-api-key
Use Python Boto3 library: create-api-key
You may have to install AWS Tools for Windows PowerShell for option #1

Related

How can I go about using Hasura CLI to export metadata via Windows Active Directory Login?

Here is information about our technical environment:
Hasura GraphQL Current server version: v2.6.2-pro.1
Hasura CLI version 2.15.0
We log onto the Hasura GraphQL Web UI Console using our Windows Active Directory Login (essentially Single-SignOn SSO) (therefore,
we do not have an admin secret)
However, the official Hasura GraphQL Technical Tutorial Guide only gives examples showing the admin secret being supplied in the Hasura CLI command line console arguments (https://hasura.io/docs/latest/migrations-metadata-seeds/migrations-metadata-setup/)
hasura init demo-project --endpoint https://docs-demo.hasura.app --admin-secret mySecret
How can I go about using Hasura CLI to export metadata via Windows Active Directory Login? (I would be interested in Hasura CLI command line examples).
as of now you’ll have to set an admin secret via environment variables and use that via the CLI. Please file a feature request via Github if you need this so we can get it tracked and prioritized.

Running API calls from rundeck to Google cloud

I am configuring rundeck to issue api calls to the google cloud compute api
I have tried both basic and oath 2.0 for authentication
Has anyone gotten this to work
You have two options:
Configure the google cloud CLI tool for "rundeck" user, (home at /var/lib/rundeck) or:
Use local sudo rundeck plugin to call the command using the user profile which you have the google cloud CLI configured.
In the first option you can use command steps/script steps to call the Google Cloud CLI tool and in the second one using the Local Command Workflow Step and the Local Script Workflow Step.

Generate service account credentials from gcloud utility

I am looking for a way to generate the json that I would through the web ui from gcloud utility. From the documentation, I can see I can do this through an api request (https://cloud.google.com/iam/reference/rest/v1/projects.serviceAccounts.keys/create). However I am trying to do it through the utility.
Thank you very much for reading
I managed to do this through this command, as shown in the documentation:
gcloud iam service-accounts keys create NAME_OF_THE_FILE.json --iam-account=EMAIL

Enable/disable Azure Logic App using CLI

Is it possible to enable/disable an Azure Logic App using the CLI? I didn't find anything about it in the documentation.
There's a way to do it via the REST API, which requires creating an access token. However, since I'm running from my shell or from VSTS (which has a az CLI task), I'm already authorized there so I'd like to simplify this process using the CLI.
You should be able to do it using the following command
az resource invoke-action --action disable --name 'YOURLOGICAPP' -g 'YOURRESOURCEGROUP' --resource-type 'Microsoft.Logic/workflows'

how to register aws ec2 instance launch API in TFS service endpoint?

My requirement is, need to launch an AWS EC2 Instance through REST API while TFS running.
For that I need to register the API in TFS as Generic Service Endpoint.
I am not aware how to add the API endpoint because the endpoint contains many header values and signatures.
I hope we can pass the Signature in token.
But what need to pass for UserName?
Could anyone know how to register the AWS REST API in TFS service Endpoint.?
You should do this task via powershell script and just add a powershell step in the TFS build/release workflow. You have flexibility to run it via powershell command line without the TFS web UI. Also the script is portable. It can be invoked in TFS,Jenkins, etc.
It's not able to register aws ec2 instance API in TFS Generic Service Endpoint.
You could use a powershell script to authenticate with AWS API to launch a EC2 instance and invoke the REST API from your Build Pipeline.
Besides, you could use AWS Tools for Microsoft Visual Studio Team Services.
This tool include a new service endpoint type, AWS, to supply AWS credentials to the tasks at runtime.
It will create an AWS Credentials Connection. Select the AWS endpoint type and provide the following parameters:
A name used to refer to the credentials when configuring tasks that
require AWS credentials
AWS Access Key ID
AWS Secret Access Key
After an AWS subscription has be linked to Team Foundation Server, you could use the task deploy to Amazon EC2 with AWS CodeDeploy.
Note: Minimum supported environments
Visual Studio Team Services
Team Foundation Server 2015 Update 3 (or higher)