arazzo: 1.0.1
info:
title: Amazon EC2 Rotate Key Pair
summary: Verify a key pair exists, create its replacement, then delete the old key pair.
description: >-
Rotates an SSH key pair without leaving a gap in coverage. The workflow
confirms the existing key pair is present, creates a new replacement key
pair, and only then deletes the old key pair. Every step spells out its
request inline using the Amazon EC2 query protocol (Action and Version
parameters) so the flow can be read and executed without opening the
underlying OpenAPI description.
version: 1.0.0
sourceDescriptions:
- name: keyPairsApi
url: ../openapi/amazon-ec2-keypairs-api-openapi.yml
type: openapi
workflows:
- workflowId: rotate-key-pair
summary: Replace an existing SSH key pair with a freshly created one.
description: >-
Chains DescribeKeyPairs, CreateKeyPair, and DeleteKeyPair so the new key is
in place before the old key is removed.
inputs:
type: object
required:
- oldKeyName
- newKeyName
properties:
oldKeyName:
type: string
description: The name of the existing key pair to retire.
newKeyName:
type: string
description: The name for the replacement key pair.
steps:
- stepId: verifyOldKey
description: Confirm the existing key pair is present before rotating.
operationId: DescribeKeyPairs
requestBody:
contentType: application/x-www-form-urlencoded
payload:
Action: DescribeKeyPairs
Version: '2016-11-15'
KeyNames:
- $inputs.oldKeyName
successCriteria:
- condition: $statusCode == 200
outputs:
verifyStatus: $statusCode
- stepId: createNewKey
description: Create the replacement key pair.
operationId: CreateKeyPair
requestBody:
contentType: application/x-www-form-urlencoded
payload:
Action: CreateKeyPair
Version: '2016-11-15'
KeyName: $inputs.newKeyName
KeyType: ed25519
successCriteria:
- condition: $statusCode == 200
outputs:
createStatus: $statusCode
- stepId: deleteOldKey
description: Delete the retired key pair now that its replacement exists.
operationId: DeleteKeyPair
requestBody:
contentType: application/x-www-form-urlencoded
payload:
Action: DeleteKeyPair
Version: '2016-11-15'
KeyName: $inputs.oldKeyName
successCriteria:
- condition: $statusCode == 200
outputs:
deleteStatus: $statusCode
outputs:
createStatus: $steps.createNewKey.outputs.createStatus
deleteStatus: $steps.deleteOldKey.outputs.deleteStatus
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Get an API key
Free tier, no form to fill in. Signing in shares your email address with us — we
store it to create your key and to recognise you if you sign in with another
provider. By signing up you are subscribing to the APIs.io and API Evangelist
newsletters — you can unsubscribe from any issue. See our
Privacy Policy and Terms.