我正在尝试从本地 PC 访问 AWS RDS 实例。
我遵循以下故障排除程序:
如何排查与使用 VPC 公有或私有子网的 Amazon RDS 实例的连接问题?
我检查了公共可访问性是YES
并切换到公有子网,但仍然无法访问RDS实例。
有人可以帮忙吗?
我一直在尝试在命令行上创建秘密,如下所示:
~/$ aws secretsmanager create-secret --name first-secret
{
"ARN": "arn:aws:secretsmanager:us-east-2:123456789012:secret:first-secret-9ez7W2",
"Name": "first-secret"
}
~/$ aws secretsmanager get-secret-value --secret-id first-secret
An error occurred (ResourceNotFoundException) when calling the GetSecretValue operation: Secrets Manager can't find the specified secret value for staging label: AWSCURRENT
Run Code Online (Sandbox Code Playgroud)
如果我在 AWS 控制台上创建秘密(接受默认选择),我可以毫无问题地“获取秘密值”。
在这方面,AWS 控制台和命令行有什么区别?
解决了 我必须添加一个秘密字符串:--secret-string '[{"username":"user"},{"password":"password"}]'
我有两种情况:
#!/usr/bin/env bash
sleep infinity
# When I type Ctrl-C here, "sleep" command and script are stopped so I didn't see "End"
echo End
Run Code Online (Sandbox Code Playgroud)
#!/usr/bin/env bash
docker exec container-id sleep infinity
# When I type Ctrl-C here, "docker exec" command is stopped but script continued so I saw "End"
echo End
Run Code Online (Sandbox Code Playgroud)
为什么行为上有差异?
我有这个脚本(test.sh):
#!/bin/bash
set -o errtrace
trap 'echo $BASH_VERSION >&2' ERR
echo <(cat<<EOF
Hello world
EOF
)
Run Code Online (Sandbox Code Playgroud)
运行它,我得到:
~/tmp$ bash test.sh
/dev/fd/63
~/tmp$ 5.0.18(1)-release
Run Code Online (Sandbox Code Playgroud)
两个问题:
为什么会触发 ERR 陷阱?
为什么5.0.18(1)-release在下一个提示之后,而不是在它之前
我有这个 package.json
{
"dependencies": {
"body-parser": "^1.19.0",
"eslint": "^7.15.0",
"express": "^4.17.1"
}
}
Run Code Online (Sandbox Code Playgroud)
使用此命令:
jq '.dependencies.eslint="latest"|.dependencies.express="latest"' package.json
Run Code Online (Sandbox Code Playgroud)
我得到了这个结果:
{
"dependencies": {
"body-parser": "^1.19.0",
"eslint": "latest",
"express": "latest"
}
}
Run Code Online (Sandbox Code Playgroud)
如何在不枚举单个密钥的情况下将所有版本更改为“最新”?
我有这个有效的课程:
class Point:
def __init__(self):
self.checks = [self.check1, self.check2]
def check1(self):
return True
def check2(self):
return True
def run_all_checks(self):
for check in self.checks:
check()
Run Code Online (Sandbox Code Playgroud)
实例变量checks并不特定于实例,因此我想将其移至类级别,这是我的尝试:
class Point:
def __new__(cls, *args, **kwargs):
cls.checks = [cls.check1, cls.check2]
return super(Point, cls).__new__(cls, *args, **kwargs)
def check1(self):
return True
def check2(self):
return True
def run_all_checks(self):
for check in self.checks:
check()
Run Code Online (Sandbox Code Playgroud)
类定义seems可以工作(在没有syntax错误的意义上),但是当我运行它时,出现错误:
TypeError: Point.check1() missing 1 required positional argument: 'self'
Run Code Online (Sandbox Code Playgroud)
更新
通过@juanpa.arrivilillaga的解决方案,我的问题得到了解决:
class ParentFuncs:
def check1(self):
print("check1")
def check2(self):
print("check2") …Run Code Online (Sandbox Code Playgroud)