I wrote a simple typescript with AWS CDK and try to get the account id
import cdk = require("@aws-cdk/core");
const app = new cdk.Stack();
console.log(app.account);
Run Code Online (Sandbox Code Playgroud)
But get below output
$ tsc index.ts
$ node index.js
${Token[AWS::AccountId.0]}
Run Code Online (Sandbox Code Playgroud)
So what's the meaning of Token here? How to get the real account id?
$ cdk init app --language=typescript
# replace lib/<name>-stack.ts with @Rob Raisch 's code
$ cdk synth
${Token[AWS::AccountId.0]}
Outputs:
MyStackAccount:
Description: Account of this stack
Value:
Ref: AWS::AccountId
Resources:
CDKMetadata: …Run Code Online (Sandbox Code Playgroud) 我想设置一个持久卷(pv 和 pvc),由Kind 集群中的 pod 共享。但是我还需要将数据保留在我的笔记本电脑(主机服务器)中,因此卷的路径应该是我的笔记本电脑中的某些内容,我可以直接访问它。
如果我删除 kind 集群,该卷应该被持久化,而不是被破坏。
我希望可以轻松地添加或更新该卷,或者从我的主机笔记本电脑中复制文件。
如何让 Pod 在 KIND 集群中知道它?
粘贴我的kind.yaml供您参考
$ kind
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
- role: worker
- role: worker
- role: worker
Run Code Online (Sandbox Code Playgroud) 根据公司合规政策,我正在寻找解决方案来阻止客户端(100多个aws账户)创建具有公共IP的ec2实例,或者在创建后尝试在其上附加弹性IP。
我正在考虑使用AWS Organization SCP来实现它,所以我不需要在个人账户中设置它。但无法获得适当的 SCP 政策来做到这一点。
供您参考的 SCP 策略,我可以使用以下策略阻止 s3 公共访问,我需要类似于 ec2 实例。
{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"s3:PutAccountPublicAccessBlock"
],
"Resource": "*",
"Effect": "Deny"
}
]
}
Run Code Online (Sandbox Code Playgroud)
理想情况下,使用正确的 SCP 策略,当客户端在 Orgainzation OU 下的帐户中时,如果允许公共 IP,则无法创建 ec2 实例,或者在创建 ec2 后,当他们尝试附加弹性 IP 时,scp 应阻止它。
谢谢,@约翰
让我试试这个政策
{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"ec2:AssociateAddress"
],
"Resource": "*",
"Effect": "Deny"
}
]
}
Run Code Online (Sandbox Code Playgroud)
上述 scp 策略不起作用,我仍然可以使用公共 IP 创建新实例
每当我尝试运行命令时 -
kc.bat start-dev --http-port="port number
Run Code Online (Sandbox Code Playgroud)
它显示一些错误称为
unmatched argument at index 3: "port number
Run Code Online (Sandbox Code Playgroud) amazon-iam ×1
aws-cdk ×1
docker ×1
keycloak ×1
kind ×1
kubernetes ×1
port ×1
quarkus ×1
typescript ×1