我在一家大公司的一个小团队中工作。
所有网络流量都会经过公司的防火墙,我认为当任何流量进入时,防火墙就像中间人一样。
我看到这一点的一个例子是在使用时curl
c:\>curl https://www.google.com
curl: (60) SSL certificate problem: self signed certificate in certificate chain
Run Code Online (Sandbox Code Playgroud)
所以我检查证书链:
c:\>openssl s_client -connect google.com:443
Run Code Online (Sandbox Code Playgroud)
然后返回(删除一些细节)
Certificate chain
0 s:/C=US/ST=California/L=Mountain View/O=Google Inc/CN=*.google.com
i:/C=US/My Company's Intermediate CA
1 s:/C=US/My Company's Intermediate CA
i:/C=US/My Company's Root CA
2 s:/C=US/My Company's Root CA
i:/C=US/My Company's Root CA
Run Code Online (Sandbox Code Playgroud)
这给使用npm或Composer等包管理器带来了挑战,因为https
由于自签名证书错误,或者根本无法验证证书,一切都会失败
我可以通过设置配置值和来让npm工作,但这是一种不安全的做法。ca=""
strict-ssl=false
我希望我们的开发团队能够访问包管理器,特别是npm和composer
鉴于我无法更改防火墙的工作方式,我可以在本地计算机 (Windows 7) 或 VM (Windows Server 2008 R2) 上进行任何更改,以便我们的开发团队能够充分利用这些软件包管理者安全。
谢谢!!
我使用 AWS CDK (python) 创建一个具有隔离子网和多个接口终端节点的 VPC。
我还推出了带有关联 Codecommit 存储库的Sagemaker 笔记本
我为 Codecommit 和 Git Codecommit 创建接口端点,但当我的 Sagemaker 笔记本开始部署时,接口端点仍在创建,因此 Cloudformation 堆栈失败并出现错误
fatal: unable to access 'https://git-codecommit.us-east-1.amazonaws.com/v1/repos/SomeRepo/': Failed to connect to git-codecommit.us-east-1.amazonaws.com port 443: Connection timed out
Run Code Online (Sandbox Code Playgroud)
如果我注释掉我的 Sagemaker 笔记本,运行cdk deploy myStack
,创建端点,然后我可以取消注释我的笔记本,它会毫无问题地启动,因为 Codecommit 接口端点已经存在。
CDK 中有没有办法将 a 添加DependsOn
到我使用 CDK 创建的资源中?
相关代码如下
fatal: unable to access 'https://git-codecommit.us-east-1.amazonaws.com/v1/repos/SomeRepo/': Failed to connect to git-codecommit.us-east-1.amazonaws.com port 443: Connection timed out
Run Code Online (Sandbox Code Playgroud) 我在通过 cloudformation 创建现货队列请求时遇到错误。请求已创建,但当队列尝试请求实例时,我收到标题中提到的错误。
此处描述了所需的权限,但是当我尝试按照步骤创建AWSServiceRoleForEC2SpotFleet
角色时,我没有选择“EC2 - Spot Fleet”的选项,只能选择 EC2 FLeet。奇怪的是,当我创建 CF 堆栈时,它实际上确实为我创建了该服务链接角色。
我的用户拥有管理员凭据,并且我使用“aws-ec2-spot-fleet-tagging-role”作为队列角色。
据我了解,服务链接角色只需要存在即可使其工作,但我无法手动创建它。我能够通过控制台成功创建队列,使用与模板中使用的完全相同的值,并且我也在那里选择相同的“aws-ec2-spot-fleet-tagging-role”。
我还向我的用户提供了该文档中提到的 IAM 凭据,即使它是管理员,只是为了查看我是否需要传递权限,但据我所知,只有当我在启动规范中提供实例配置文件时,我才真正需要它,我不是。这是我在模板中的资源定义:
SpotFleetRequestConfigData:
TargetCapacity: 1
IamFleetRole: arn:aws:iam::73682036499:role/aws-ec2-spot-fleet-tagging-role
LaunchSpecifications:
- ImageId: '{{resolve:ssm:TestImage:4}}' #param stored reference to AMI
InstanceType: t2.small
NetworkInterfaces:
- SubnetId: !ImportValue CustomVPCStack-dmz-subnet-1
DeviceIndex: 0
Groups:
- !Ref EC2MCServerSecurityGroup
TagSpecifications:
-
ResourceType: instance
Tags:
-
Key: Name
Value: spotfleetserver
ReplaceUnhealthyInstances: true
Type: maintain #default```
Run Code Online (Sandbox Code Playgroud) 在AWS Key Management Service Best Practices 白皮书中关于使用 Amazon EBS 进行静态数据加密的部分中,它指出:
有两种方法可以确保 EBS 卷始终加密。您可以
CreateVolume
通过 IAM 策略验证作为上下文一部分的加密标志是否设置为“true”。如果标志不是“true”,则 IAM 策略可以阻止个人创建 EBS 卷
我怎样才能做到这一点?我想这个政策会是这样的:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Stmt1509465260000",
"Effect": "Allow",
"Action": [
"ec2:CreateVolume"
],
"Condition": {
"Bool": {
"ec2:Encrypted": "true"
}
},
"Resource": [
"*"
]
}
]
}
Run Code Online (Sandbox Code Playgroud)
根据白皮书和文档,密钥Bool
上的条件ec2:Encrypted
最有意义,但是在尝试创建加密卷时,我的访问被拒绝。
我在声明中遗漏了什么?
我正在尝试使用最新版本的 AWS CDK for typescript (1.128) 设置一个全新的管道。
管道的创建非常简单。我已经添加了源代码和构建阶段,没有任何问题。这里的目标是自动部署静态登陆页面。
到目前为止我有这段代码:
const landingPageStep = new ShellStep(`${PREFIX}LandingPageCodeBuildStep`, {
input: CodePipelineSource.connection(`${GIT_ORG}/vicinialandingpage`, GIT_MAIN, {
connectionArn: GIT_CONNECTION_ARN, // Created using the AWS console
}),
installCommands: [
'npm ci',
],
commands: [
'npm run build',
],
primaryOutputDirectory: 'out',
})
const pipeline = new CodePipeline(this, `${PREFIX}Pipeline`, {
pipelineName: `${PREFIX}Pipeline`,
synth: new ShellStep(`${PREFIX}Synth`, {
input: CodePipelineSource.connection(`${GIT_ORG}/viciniacdk`, GIT_MAIN, {
connectionArn: GIT_CONNECTION_ARN, // Created using the AWS console
}),
commands: [
'npm ci',
'npm run build',
'npx cdk synth',
],
additionalInputs: …
Run Code Online (Sandbox Code Playgroud) amazon-s3 amazon-web-services aws-codepipeline aws-cdk static-web-apps
我有一份 Jenkins 工作来构建我的 JS 应用程序。
在我的package.json
我有一个看起来像这样的依赖:
"devDependencies": {
"my_private_package": "git+https://my-server/my-repo.git#1.0.0"
}
Run Code Online (Sandbox Code Playgroud)
我使用Jenkins Git Plugin和Credentials Plugin来克隆 repo,然后使用 shell 脚本运行npm install
.
当 Jenkins 运行时npm install
,npm
出现错误npm ERR! fatal: Authentication failed
由于我们自托管的 git 服务器和官僚作风,我无法通过向 git url 添加 oAuth 令牌做任何事情。
有没有办法让我设置我的 git 凭据,以便 npm 可以从我的受密码保护的 git repo 安装?
在我的模板中,我正在配置一个使用EC2 启动模板的ASG
在本UserData
节中,我做了一个cfn-init
配置实例,效果很好。
但是,当我执行该cfn-signal
命令时,该命令成功(退出代码为 0),但 Cloudformation 堆栈从未收到它,并且堆栈创建/更新失败,并显示Failed to receive 1 resource signal(s) for the current batch. Each resource signal timeout is counted as a FAILURE.
当我检查 Cloudtrail 时,我看到API 调用已完成,并用, (但 a of )SignalResource
表示正确的堆栈和资源SUCCESS
responseElements
null
摘自我的 Cloudformation 模板:
Resources:
MyLaunchTemplate:
Type: AWS::EC2::LaunchTemplate
Metadata:
'AWS::CloudFormation::Init':
configSets:
# lots-o-stuff to be done by cfn-init
Properties:
LaunchTemplateData:
# Remove other attributes for brevity
UserData:
Fn::Base64:
!Sub |
#!/bin/bash -x
yum update -y …
Run Code Online (Sandbox Code Playgroud) 我使用conda_python3
内核启动了一个 Sagemaker notebook ,并按照Random Cut Forest的示例Notebook 进行操作。
在撰写本文时,附带的Sagemaker SDKconda_python3
版本为 1.72.0,但我想使用新功能,因此我更新了我的笔记本以使用最新的
%%bash
pip install -U sagemaker
Run Code Online (Sandbox Code Playgroud)
我看到它更新。
print(sagemaker.__version__)
# 2.4.1
Run Code Online (Sandbox Code Playgroud)
从 1.x 版到 2.x 版的变化是序列化器/反序列化器类
以前(在 1.72.0 版中)我会更新我的预测器以使用正确的序列化器/反序列化器,并且可以在我的模型上运行推理
from sagemaker.predictor import csv_serializer, json_deserializer
rcf_inference = rcf.deploy(
initial_instance_count=1,
instance_type='ml.m4.xlarge',
)
rcf_inference.content_type = 'text/csv'
rcf_inference.serializer = csv_serializer
rcf_inference.accept = 'application/json'
rcf_inference.deserializer = json_deserializer
results = rcf_inference.predict(some_numpy_array)
Run Code Online (Sandbox Code Playgroud)
(请注意,这一切都来自示例
我尝试使用 sagemaker 2.4.1 像这样复制它
from sagemaker.deserializers import JSONDeserializer
from sagemaker.serializers import CSVSerializer
rcf_inference = rcf.deploy( …
Run Code Online (Sandbox Code Playgroud) 在npm
我可以跑步
npm config set cafile "path/to/my/cert.pem"
Run Code Online (Sandbox Code Playgroud)
你能和Facebook做类似的事情yarn
吗?
运行时yarn -h
,看不到用于设置任何类型配置的任何选项。
我想念什么吗?
我使用 aws-cdk 创建了 2 个 VPC。cdk 在创建 cloudformation 堆栈时动态创建路由表。我在创建的两个 VPC 之间创建了一个对等连接,CfnVPCPeeringConnection
但我不确定如何将路由添加到 vpc 对等连接,因为我不知道 RouteTableId 是什么。
aws-cdk ×3
npm ×2
amazon-ebs ×1
amazon-ec2 ×1
amazon-iam ×1
amazon-s3 ×1
aws-cli ×1
certificate ×1
composer-php ×1
git ×1
jenkins ×1
networking ×1
python-3.x ×1
ssl ×1
windows ×1
yarnpkg ×1