ZhangZhihui's Blog  

 

 

复制代码
zzh@ZZHPC:~$ aws configure
AWS Access Key ID [None]: xxxxxxxxxxxxxxxxxxxx
AWS Secret Access Key [None]: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Default region name [None]: ap-southeast-2
Default output format [None]: json
zzh@ZZHPC:~$ ls -l .aws
total 8
-rw------- 1 zzh zzh  43 Dec 17 19:58 config
-rw------- 1 zzh zzh 116 Dec 17 19:58 credentials
复制代码

 

复制代码
zzh@ZZHPC:~$ aws secretsmanager help

AVAILABLE COMMANDS
o batch-get-secret-value

o cancel-rotate-secret

o create-secret

o delete-resource-policy

o delete-secret

o describe-secret

o get-random-password

o get-resource-policy

o get-secret-value

o help

o list-secret-version-ids

o list-secrets

o put-resource-policy

o put-secret-value

o remove-regions-from-replication

o replicate-secret-to-regions

o restore-secret

o rotate-secret

o stop-replication-to-replica

o tag-resource

o untag-resource

o update-secret

o update-secret-version-stage

o validate-resource-policy

复制代码
zzh@ZZHPC:~$ aws secretsmanager get-secret-value --secret-id zimple_bank

An error occurred (AccessDeniedException) when calling the GetSecretValue operation: User: arn:aws:iam::793698357301:user/github-ci is not authorized to perform: secretsmanager:GetSecretValue on resource: zimple_bank because no identity-based policy allows the secretsmanager:GetSecretValue action

Solution:

 

 

复制代码
zzh@ZZHPC:~$ aws secretsmanager get-secret-value help


SYNOPSIS
            get-secret-value
          --secret-id <value>
          [--version-id <value>]
          [--version-stage <value>]
          [--cli-input-json | --cli-input-yaml]
          [--generate-cli-skeleton <value>]
          [--debug]
          [--endpoint-url <value>]
          [--no-verify-ssl]
          [--no-paginate]
          [--output <value>]
          [--query <value>]
          [--profile <value>]
          [--region <value>]
          [--version <value>]
          [--color <value>]
          [--no-sign-request]
          [--ca-bundle <value>]
          [--cli-read-timeout <value>]
          [--cli-connect-timeout <value>]
          [--cli-binary-format <value>]
          [--no-cli-pager]
          [--cli-auto-prompt]
          [--no-cli-auto-prompt]

OPTIONS
       --secret-id (string)
          The ARN or name of the secret to retrieve.

          For an ARN, we recommend that you specify a complete ARN rather than
          a partial ARN. See Finding a secret from a partial ARN .

       --version-id (string)
          The  unique  identifier of the version of the secret to retrieve. If
          you include both this parameter and VersionStage , the  two  parame-
          ters must refer to the same secret version. If you don't specify ei-
          ther a VersionStage or VersionId , then Secrets Manager returns  the
          AWSCURRENT version.

          This  value  is typically a UUID-type value with 32 hexadecimal dig-
          its.
......
复制代码

 

zzh@ZZHPC:~/.aws$ aws secretsmanager get-secret-value --secret-id zimple_bank --query SecretString
zzh@ZZHPC:~/.aws$ aws secretsmanager get-secret-value --secret-id zimple_bank --query SecretString --output text
复制代码
zzh@ZZHPC:~/.aws$ aws secretsmanager get-secret-value --secret-id zimple_bank --query SecretString --output text | jq 'to_entries'
[
  {
    "key": "DB_SOURCE",
    "value": "xxxxxxxxxx"
  },
  {
    "key": "TOKEN_SYMMETRIC_KEY",
    "value": "xxxxxxxxxx"
  }
]
复制代码
zzh@ZZHPC:~/.aws$ aws secretsmanager get-secret-value --secret-id zimple_bank --query SecretString --output text | jq 'to_entries|map("\(.key)=\(.value)")'
[
  "DB_SOURCE=xxxxxxxxxx",
  "TOKEN_SYMMETRIC_KEY=xxxxxxxxxx"
]
zzh@ZZHPC:~/.aws$ aws secretsmanager get-secret-value --secret-id zimple_bank --query SecretString --output text | jq 'to_entries|map("\(.key)=\(.value)")|.[]'
"DB_SOURCE=xxxxxxxxxx"
"TOKEN_SYMMETRIC_KEY=xxxxxxxxxx"
zzh@ZZHPC:~/.aws$ aws secretsmanager get-secret-value --secret-id zimple_bank --query SecretString --output text | jq -r 'to_entries|map("\(.key)=\(.value)")|.[]'
DB_SOURCE=xxxxxxxxx
TOKEN_SYMMETRIC_KEY=xxxxxxxxxx

 

posted on   ZhangZhihuiAAA  阅读(7)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律
 
点击右上角即可分享
微信分享提示