secretsmanager-2017-10-17.examples.json 22.1 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594
{
  "version": "1.0",
  "examples": {
    "CancelRotateSecret": [
      {
        "input": {
          "SecretId": "MyTestDatabaseSecret"
        },
        "output": {
          "ARN": "arn:aws:secretsmanager:us-west-2:123456789012:secret:MyTestDatabaseSecret-a1b2c3",
          "Name": "Name"
        },
        "comments": {
          "input": {
          },
          "output": {
          }
        },
        "description": "The following example shows how to cancel rotation for a secret. The operation sets the RotationEnabled field to false and cancels all scheduled rotations. To resume scheduled rotations, you must re-enable rotation by calling the rotate-secret operation.",
        "id": "to-cancel-scheduled-rotation-for-a-secret-1523996016032",
        "title": "To cancel scheduled rotation for a secret"
      }
    ],
    "CreateSecret": [
      {
        "input": {
          "ClientRequestToken": "EXAMPLE1-90ab-cdef-fedc-ba987SECRET1",
          "Description": "My test database secret created with the CLI",
          "Name": "MyTestDatabaseSecret",
          "SecretString": "{\"username\":\"david\",\"password\":\"BnQw!XDWgaEeT9XGTT29\"}"
        },
        "output": {
          "ARN": "arn:aws:secretsmanager:us-west-2:123456789012:secret:MyTestDatabaseSecret-a1b2c3",
          "Name": "MyTestDatabaseSecret",
          "VersionId": "EXAMPLE1-90ab-cdef-fedc-ba987SECRET1"
        },
        "comments": {
          "input": {
          },
          "output": {
          }
        },
        "description": "The following example shows how to create a secret. The credentials stored in the encrypted secret value are retrieved from a file on disk named mycreds.json.",
        "id": "to-create-a-basic-secret-1523996473658",
        "title": "To create a basic secret"
      }
    ],
    "DeleteResourcePolicy": [
      {
        "input": {
          "SecretId": "MyTestDatabaseSecret"
        },
        "output": {
          "ARN": "arn:aws:secretsmanager:us-west-2:123456789012:secret:MyTestDatabaseMasterSecret-a1b2c3",
          "Name": "MyTestDatabaseSecret"
        },
        "comments": {
          "input": {
          },
          "output": {
          }
        },
        "description": "The following example shows how to delete the resource-based policy that is attached to a secret.",
        "id": "to-delete-the-resource-based-policy-attached-to-a-secret-1530209419204",
        "title": "To delete the resource-based policy attached to a secret"
      }
    ],
    "DeleteSecret": [
      {
        "input": {
          "RecoveryWindowInDays": 7,
          "SecretId": "MyTestDatabaseSecret1"
        },
        "output": {
          "ARN": "arn:aws:secretsmanager:us-west-2:123456789012:secret:MyTestDatabaseSecret-a1b2c3",
          "DeletionDate": "1524085349.095",
          "Name": "MyTestDatabaseSecret"
        },
        "comments": {
          "input": {
          },
          "output": {
          }
        },
        "description": "The following example shows how to delete a secret. The secret stays in your account in a deprecated and inaccessible state until the recovery window ends. After the date and time in the DeletionDate response field has passed, you can no longer recover this secret with restore-secret.",
        "id": "to-delete-a-secret-1523996905092",
        "title": "To delete a secret"
      }
    ],
    "DescribeSecret": [
      {
        "input": {
          "SecretId": "MyTestDatabaseSecret"
        },
        "output": {
          "ARN": "arn:aws:secretsmanager:us-west-2:123456789012:secret:MyTestDatabaseSecret-a1b2c3",
          "Description": "My test database secret",
          "KmsKeyId": "arn:aws:kms:us-west-2:123456789012:key/EXAMPLE1-90ab-cdef-fedc-ba987KMSKEY1",
          "LastAccessedDate": "1523923200",
          "LastChangedDate": 1523477145.729,
          "LastRotatedDate": 1525747253.72,
          "Name": "MyTestDatabaseSecret",
          "RotationEnabled": true,
          "RotationLambdaARN": "arn:aws:lambda:us-west-2:123456789012:function:MyTestRotationLambda",
          "RotationRules": {
            "AutomaticallyAfterDays": 30
          },
          "Tags": [
            {
              "Key": "SecondTag",
              "Value": "AnotherValue"
            },
            {
              "Key": "FirstTag",
              "Value": "SomeValue"
            }
          ],
          "VersionIdsToStages": {
            "EXAMPLE1-90ab-cdef-fedc-ba987EXAMPLE": [
              "AWSPREVIOUS"
            ],
            "EXAMPLE2-90ab-cdef-fedc-ba987EXAMPLE": [
              "AWSCURRENT"
            ]
          }
        },
        "comments": {
          "input": {
          },
          "output": {
          }
        },
        "description": "The following example shows how to get the details about a secret.",
        "id": "to-retrieve-the-details-of-a-secret-1524000138629",
        "title": "To retrieve the details of a secret"
      }
    ],
    "GetRandomPassword": [
      {
        "input": {
          "IncludeSpace": true,
          "PasswordLength": 20,
          "RequireEachIncludedType": true
        },
        "output": {
          "RandomPassword": "N+Z43a,>vx7j O8^*<8i3"
        },
        "comments": {
          "input": {
          },
          "output": {
          }
        },
        "description": "The following example shows how to request a randomly generated password. This example includes the optional flags to require spaces and at least one character of each included type. It specifies a length of 20 characters.",
        "id": "to-generate-a-random-password-1524000546092",
        "title": "To generate a random password"
      }
    ],
    "GetResourcePolicy": [
      {
        "input": {
          "SecretId": "MyTestDatabaseSecret"
        },
        "output": {
          "ARN": "arn:aws:secretsmanager:us-west-2:123456789012:secret:MyTestDatabaseSecret-a1b2c3",
          "Name": "MyTestDatabaseSecret",
          "ResourcePolicy": "{\n\"Version\":\"2012-10-17\",\n\"Statement\":[{\n\"Effect\":\"Allow\",\n\"Principal\":{\n\"AWS\":\"arn:aws:iam::123456789012:root\"\n},\n\"Action\":\"secretsmanager:GetSecretValue\",\n\"Resource\":\"*\"\n}]\n}"
        },
        "comments": {
          "input": {
          },
          "output": {
          }
        },
        "description": "The following example shows how to retrieve the resource-based policy that is attached to a secret.",
        "id": "to-retrieve-the-resource-based-policy-attached-to-a-secret-1530209677536",
        "title": "To retrieve the resource-based policy attached to a secret"
      }
    ],
    "GetSecretValue": [
      {
        "input": {
          "SecretId": "MyTestDatabaseSecret",
          "VersionStage": "AWSPREVIOUS"
        },
        "output": {
          "ARN": "arn:aws:secretsmanager:us-west-2:123456789012:secret:MyTestDatabaseSecret-a1b2c3",
          "CreatedDate": 1523477145.713,
          "Name": "MyTestDatabaseSecret",
          "SecretString": "{\n  \"username\":\"david\",\n  \"password\":\"BnQw&XDWgaEeT9XGTT29\"\n}\n",
          "VersionId": "EXAMPLE1-90ab-cdef-fedc-ba987SECRET1",
          "VersionStages": [
            "AWSPREVIOUS"
          ]
        },
        "comments": {
          "input": {
          },
          "output": {
          }
        },
        "description": "The following example shows how to retrieve the secret string value from the version of the secret that has the AWSPREVIOUS staging label attached. If you want to retrieve the AWSCURRENT version of the secret, then you can omit the VersionStage parameter because it defaults to AWSCURRENT.",
        "id": "to-retrieve-the-encrypted-secret-value-of-a-secret-1524000702484",
        "title": "To retrieve the encrypted secret value of a secret"
      }
    ],
    "ListSecretVersionIds": [
      {
        "input": {
          "IncludeDeprecated": true,
          "SecretId": "MyTestDatabaseSecret"
        },
        "output": {
          "ARN": "arn:aws:secretsmanager:us-west-2:123456789012:secret:MyTestDatabaseSecret-a1b2c3",
          "Name": "MyTestDatabaseSecret",
          "Versions": [
            {
              "CreatedDate": 1523477145.713,
              "VersionId": "EXAMPLE1-90ab-cdef-fedc-ba987EXAMPLE",
              "VersionStages": [
                "AWSPREVIOUS"
              ]
            },
            {
              "CreatedDate": 1523486221.391,
              "VersionId": "EXAMPLE2-90ab-cdef-fedc-ba987EXAMPLE",
              "VersionStages": [
                "AWSCURRENT"
              ]
            },
            {
              "CreatedDate": 1511974462.36,
              "VersionId": "EXAMPLE3-90ab-cdef-fedc-ba987EXAMPLE;"
            }
          ]
        },
        "comments": {
          "input": {
          },
          "output": {
          }
        },
        "description": "The following example shows how to retrieve a list of all of the versions of a secret, including those without any staging labels.",
        "id": "to-list-all-of-the-secret-versions-associated-with-a-secret-1524000999164",
        "title": "To list all of the secret versions associated with a secret"
      }
    ],
    "ListSecrets": [
      {
        "input": {
        },
        "output": {
          "SecretList": [
            {
              "ARN": "arn:aws:secretsmanager:us-west-2:123456789012:secret:MyTestDatabaseSecret-a1b2c3",
              "Description": "My test database secret",
              "LastChangedDate": 1523477145.729,
              "Name": "MyTestDatabaseSecret",
              "SecretVersionsToStages": {
                "EXAMPLE1-90ab-cdef-fedc-ba987EXAMPLE": [
                  "AWSCURRENT"
                ]
              }
            },
            {
              "ARN": "arn:aws:secretsmanager:us-west-2:123456789012:secret:MyTestDatabaseSecret1-d4e5f6",
              "Description": "Another secret created for a different database",
              "LastChangedDate": 1523482025.685,
              "Name": "MyTestDatabaseSecret1",
              "SecretVersionsToStages": {
                "EXAMPLE2-90ab-cdef-fedc-ba987EXAMPLE": [
                  "AWSCURRENT"
                ]
              }
            }
          ]
        },
        "comments": {
          "input": {
          },
          "output": {
          }
        },
        "description": "The following example shows how to list all of the secrets in your account.",
        "id": "to-list-the-secrets-in-your-account-1524001246087",
        "title": "To list the secrets in your account"
      }
    ],
    "PutResourcePolicy": [
      {
        "input": {
          "ResourcePolicy": "{\n\"Version\":\"2012-10-17\",\n\"Statement\":[{\n\"Effect\":\"Allow\",\n\"Principal\":{\n\"AWS\":\"arn:aws:iam::123456789012:root\"\n},\n\"Action\":\"secretsmanager:GetSecretValue\",\n\"Resource\":\"*\"\n}]\n}",
          "SecretId": "MyTestDatabaseSecret"
        },
        "output": {
          "ARN": "arn:aws:secretsmanager:us-west-2:123456789012:secret:MyTestDatabaseSecret-a1b2c3",
          "Name": "MyTestDatabaseSecret"
        },
        "comments": {
          "input": {
          },
          "output": {
          }
        },
        "description": "The following example shows how to add a resource-based policy to a secret.",
        "id": "to-add-a-resource-based-policy-to-a-secret-1530209881839",
        "title": "To add a resource-based policy to a secret"
      }
    ],
    "PutSecretValue": [
      {
        "input": {
          "ClientRequestToken": "EXAMPLE2-90ab-cdef-fedc-ba987EXAMPLE",
          "SecretId": "MyTestDatabaseSecret",
          "SecretString": "{\"username\":\"david\",\"password\":\"BnQw!XDWgaEeT9XGTT29\"}"
        },
        "output": {
          "ARN": "arn:aws:secretsmanager:us-west-2:123456789012:secret:MyTestDatabaseSecret-a1b2c3",
          "Name": "MyTestDatabaseSecret",
          "VersionId": "EXAMPLE2-90ab-cdef-fedc-ba987EXAMPLE",
          "VersionStages": [
            "AWSCURRENT"
          ]
        },
        "comments": {
          "input": {
          },
          "output": {
          }
        },
        "description": "The following example shows how to create a new version of the secret. Alternatively, you can use the update-secret command.",
        "id": "to-store-a-secret-value-in-a-new-version-of-a-secret-1524001393971",
        "title": "To store a secret value in a new version of a secret"
      }
    ],
    "RestoreSecret": [
      {
        "input": {
          "SecretId": "MyTestDatabaseSecret"
        },
        "output": {
          "ARN": "arn:aws:secretsmanager:us-west-2:123456789012:secret:MyTestDatabaseSecret-a1b2c3",
          "Name": "MyTestDatabaseSecret"
        },
        "comments": {
          "input": {
          },
          "output": {
          }
        },
        "description": "The following example shows how to restore a secret that you previously scheduled for deletion.",
        "id": "to-restore-a-previously-deleted-secret-1524001513930",
        "title": "To restore a previously deleted secret"
      }
    ],
    "RotateSecret": [
      {
        "input": {
          "RotationLambdaARN": "arn:aws:lambda:us-west-2:123456789012:function:MyTestDatabaseRotationLambda",
          "RotationRules": {
            "AutomaticallyAfterDays": 30
          },
          "SecretId": "MyTestDatabaseSecret"
        },
        "output": {
          "ARN": "arn:aws:secretsmanager:us-west-2:123456789012:secret:MyTestDatabaseSecret-a1b2c3",
          "Name": "MyTestDatabaseSecret",
          "VersionId": "EXAMPLE2-90ab-cdef-fedc-ba987SECRET2"
        },
        "comments": {
          "input": {
          },
          "output": {
          }
        },
        "description": "The following example configures rotation for a secret by providing the ARN of a Lambda rotation function (which must already exist) and the number of days between rotation. The first rotation happens immediately upon completion of this command. The rotation function runs asynchronously in the background.",
        "id": "to-configure-rotation-for-a-secret-1524001629475",
        "title": "To configure rotation for a secret"
      },
      {
        "input": {
          "SecretId": "MyTestDatabaseSecret"
        },
        "output": {
          "SecretARN": "arn:aws:secretsmanager:us-west-2:123456789012:secret:MyTestDatabaseSecret-a1b2c3",
          "SecretName": "MyTestDatabaseSecret",
          "SecretVersionId": "EXAMPLE2-90ab-cdef-fedc-ba987SECRET2"
        },
        "comments": {
          "input": {
          },
          "output": {
          }
        },
        "description": "The following example requests an immediate invocation of the secret's Lambda rotation function. It assumes that the specified secret already has rotation configured. The rotation function runs asynchronously in the background.",
        "id": "to-request-an-immediate-rotation-for-a-secret-1524001949004",
        "title": "To request an immediate rotation for a secret"
      }
    ],
    "TagResource": [
      {
        "input": {
          "SecretId": "MyExampleSecret",
          "Tags": [
            {
              "Key": "FirstTag",
              "Value": "SomeValue"
            },
            {
              "Key": "SecondTag",
              "Value": "AnotherValue"
            }
          ]
        },
        "comments": {
          "input": {
          },
          "output": {
          }
        },
        "description": "The following example shows how to attach two tags each with a Key and Value to a secret. There is no output from this API. To see the result, use the DescribeSecret operation.",
        "id": "to-add-tags-to-a-secret-1524002106718",
        "title": "To add tags to a secret"
      }
    ],
    "UntagResource": [
      {
        "input": {
          "SecretId": "MyTestDatabaseSecret",
          "TagKeys": [
            "FirstTag",
            "SecondTag"
          ]
        },
        "comments": {
          "input": {
          },
          "output": {
          }
        },
        "description": "The following example shows how to remove two tags from a secret's metadata. For each, both the tag and the associated value are removed. There is no output from this API. To see the result, use the DescribeSecret operation.",
        "id": "to-remove-tags-from-a-secret-1524002239065",
        "title": "To remove tags from a secret"
      }
    ],
    "UpdateSecret": [
      {
        "input": {
          "ClientRequestToken": "EXAMPLE1-90ab-cdef-fedc-ba987EXAMPLE",
          "Description": "This is a new description for the secret.",
          "SecretId": "MyTestDatabaseSecret"
        },
        "output": {
          "ARN": "arn:aws:secretsmanager:us-west-2:123456789012:secret:MyTestDatabaseSecret-a1b2c3",
          "Name": "MyTestDatabaseSecret"
        },
        "comments": {
          "input": {
          },
          "output": {
          }
        },
        "description": "The following example shows how to modify the description of a secret.",
        "id": "to-update-the-description-of-a-secret-1524002349094",
        "title": "To update the description of a secret"
      },
      {
        "input": {
          "KmsKeyId": "arn:aws:kms:us-west-2:123456789012:key/EXAMPLE2-90ab-cdef-fedc-ba987EXAMPLE",
          "SecretId": "MyTestDatabaseSecret"
        },
        "output": {
          "ARN": "arn:aws:secretsmanager:us-west-2:123456789012:secret:MyTestDatabaseSecret-a1b2c3",
          "Name": "MyTestDatabaseSecret"
        },
        "comments": {
          "input": {
          },
          "output": {
          }
        },
        "description": "This example shows how to update the KMS customer managed key (CMK) used to encrypt the secret value. The KMS CMK must be in the same region as the secret.",
        "id": "to-update-the-kms-key-associated-with-a-secret-1524002421563",
        "title": "To update the KMS key associated with a secret"
      },
      {
        "input": {
          "SecretId": "MyTestDatabaseSecret",
          "SecretString": "{JSON STRING WITH CREDENTIALS}"
        },
        "output": {
          "ARN": "aws:arn:secretsmanager:us-west-2:123456789012:secret:MyTestDatabaseSecret-a1b2c3",
          "Name": "MyTestDatabaseSecret",
          "VersionId": "EXAMPLE1-90ab-cdef-fedc-ba987EXAMPLE"
        },
        "comments": {
          "input": {
          },
          "output": {
          }
        },
        "description": "The following example shows how to create a new version of the secret by updating the SecretString field. Alternatively, you can use the put-secret-value operation.",
        "id": "to-create-a-new-version-of-the-encrypted-secret-value-1524004651836",
        "title": "To create a new version of the encrypted secret value"
      }
    ],
    "UpdateSecretVersionStage": [
      {
        "input": {
          "MoveToVersionId": "EXAMPLE1-90ab-cdef-fedc-ba987SECRET1",
          "SecretId": "MyTestDatabaseSecret",
          "VersionStage": "STAGINGLABEL1"
        },
        "output": {
          "ARN": "arn:aws:secretsmanager:us-west-2:123456789012:secret:MyTestDatabaseSecret-a1b2c3",
          "Name": "MyTestDatabaseSecret"
        },
        "comments": {
          "input": {
          },
          "output": {
          }
        },
        "description": "The following example shows you how to add a staging label to a version of a secret. You can review the results by running the operation ListSecretVersionIds and viewing the VersionStages response field for the affected version.",
        "id": "to-add-a-staging-label-attached-to-a-version-of-a-secret-1524004783841",
        "title": "To add a staging label attached to a version of a secret"
      },
      {
        "input": {
          "RemoveFromVersionId": "EXAMPLE1-90ab-cdef-fedc-ba987SECRET1",
          "SecretId": "MyTestDatabaseSecret",
          "VersionStage": "STAGINGLABEL1"
        },
        "output": {
          "ARN": "arn:aws:secretsmanager:us-west-2:123456789012:secret:MyTestDatabaseSecret-a1b2c3",
          "Name": "MyTestDatabaseSecret"
        },
        "comments": {
          "input": {
          },
          "output": {
          }
        },
        "description": "The following example shows you how to delete a staging label that is attached to a version of a secret. You can review the results by running the operation ListSecretVersionIds and viewing the VersionStages response field for the affected version.",
        "id": "to-delete-a-staging-label-attached-to-a-version-of-a-secret-1524004862181",
        "title": "To delete a staging label attached to a version of a secret"
      },
      {
        "input": {
          "MoveToVersionId": "EXAMPLE2-90ab-cdef-fedc-ba987SECRET2",
          "RemoveFromVersionId": "EXAMPLE1-90ab-cdef-fedc-ba987SECRET1",
          "SecretId": "MyTestDatabaseSecret",
          "VersionStage": "AWSCURRENT"
        },
        "output": {
          "ARN": "arn:aws:secretsmanager:us-west-2:123456789012:secret:MyTestDatabaseSecret-a1b2c3",
          "Name": "MyTestDatabaseSecret"
        },
        "comments": {
          "input": {
          },
          "output": {
          }
        },
        "description": "The following example shows you how to move a staging label that is attached to one version of a secret to a different version. You can review the results by running the operation ListSecretVersionIds and viewing the VersionStages response field for the affected version.",
        "id": "to-move-a-staging-label-from-one-version-of-a-secret-to-another-1524004963841",
        "title": "To move a staging label from one version of a secret to another"
      }
    ],
    "ValidateResourcePolicy": [
      {
        "input": {
          "ResourcePolicy": "{\n\"Version\":\"2012-10-17\",\n\"Statement\":[{\n\"Effect\":\"Allow\",\n\"Principal\":{\n\"AWS\":\"arn:aws:iam::123456789012:root\"\n},\n\"Action\":\"secretsmanager:GetSecretValue\",\n\"Resource\":\"*\"\n}]\n}",
          "SecretId": "MyTestDatabaseSecret"
        },
        "output": {
          "PolicyValidationPassed": true,
          "ValidationErrors": [

          ]
        },
        "comments": {
          "input": {
          },
          "output": {
          }
        },
        "description": "The following example shows how to validate a resource-based policy to a secret.",
        "id": "to-validate-the-resource-policy-of-a-secret-1524000138629",
        "title": "To validate a resource-based policy to a secret"
      }
    ]
  }
}