部署 CloudFormation 堆栈时获取以下信息:
REST API 不包含任何方法(服务:AmazonApiGateway;状态代码:400;错误代码:BadRequestException;请求 ID:d527f56e-a1e1-11e9-a0a4-af7563b2b15a)
该堆栈具有由具有单个资源和方法的 API 触发的单个 Lambda:
FailureReporting:
Type: "AWS::ApiGateway::RestApi"
DependsOn: "MyLambdaFunction"
Properties:
Name: "FailureReporting"
FailOnWarnings: true
FailureReportingDeployment:
Type: AWS::ApiGateway::Deployment
Properties:
RestApiId:
Ref: "FailureReporting"
Description: "Production environment supporting version-1 of the interface."
StageName: "v1"
Failures:
Type: "AWS::ApiGateway::Resource"
Properties:
RestApiId: !Ref "FailureReporting"
ParentId: !GetAtt ["FailureReporting", "RootResourceId"]
PathPart: "failures"
FailuresMethodGet:
Type: "AWS::ApiGateway::Method"
Properties:
RestApiId: !Ref "FailureReporting"
ResourceId: !Ref "Failures"
HttpMethod: "GET"
AuthorizationType: "NONE"
MethodResponses:
- StatusCode: "200"
Integration:
IntegrationHttpMethod: "POST"
Type: "AWS_PROXY"
IntegrationResponses:
- StatusCode: "200"
Credentials: !GetAtt …Run Code Online (Sandbox Code Playgroud) 我在 CloudWatch 中有一个事件,每天触发一次。有没有办法手动触发事件(用于测试目的)?
...我意识到我可以增加事件触发计划的频率。
假设我有一个类似的功能...
function Get-Something {
return Get-DogShit
}
Run Code Online (Sandbox Code Playgroud)
...在我的 Pester 测试脚本中...
$var = 1
Mock 'Get-Dogshit' { return $var }
it 'should return true' {
Get-Something | should $var
}
Run Code Online (Sandbox Code Playgroud)
这行不通,但是你明白我在这里想做什么吗?我想将局部变量的值获取到 MOCK 脚本块中。我想避免对模拟中的返回值和 it 块中的预期结果进行硬编码。关于如何实现这一目标有什么想法吗?
您可以重命名 CloudFormation 模板中的资源吗?
假设我创建了一个堆栈模板来创建单个 lambda 函数。
GetTheFunnyPhraseText:
Type: AWS::Serverless::Function
Properties:
CodeUri: ../Lambda/
Handler: GetFunnyPhrase.handler
FunctionName: GetFunnyPhrase
Role: !GetAtt [ ExecuteFunctionGetFunnyPhrase, Arn ]
Run Code Online (Sandbox Code Playgroud)
无论出于何种原因,我想将资源名称更改GetTheFunnyPhraseText为GetFunnyPhrase. 是否有更改名称的机制?
我尝试了几件事...
GetTheFunnyPhraseText和创建GetFunnyPhrase. 这里的问题是资源创建发生在资源删除之前,导致操作失败,因为 Lambda 函数存在。对于那些建议不要命名函数的人,理解;暂时在该反馈中放置一个引脚。
我有一个本地 AWS Glue 环境,其中包含 AWS Glue 库、Spark、PySpark 以及安装的所有内容。
我正在运行以下代码(实际上是在 REPL 中复制粘贴):
from awsglue.utils import getResolvedOptions
args = []
args.insert(-1, {"--JOB_NAME": "JOB_NAME"})
args.insert(-1, {"--input_file_path": "s3://things/that.csv"})
args.insert(-1, {"--output_bucket": "s3://things"})
getResolvedOptions(args, [
'--JOB_NAME',
'--input_file_path',
'--output_bucket']
)
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
Traceback (most recent call last):
File "<stdin>", line 4, in <module>
File "C:\Users\UBI9\bin\aws-glue-libs\PyGlue.zip\awsglue\utils.py", line 115, in getResolvedOptions
File "C:\Progra~1\Python37\lib\argparse.py", line 1781, in parse_known_args
namespace, args = self._parse_known_args(args, namespace)
File "C:\Progra~1\Python37\lib\argparse.py", line 1822, in _parse_known_args
option_tuple = self._parse_optional(arg_string)
File "C:\Progra~1\Python37\lib\argparse.py", line 2108, in _parse_optional
if not arg_string[0] …Run Code Online (Sandbox Code Playgroud) 我正在 Jenkins 中编写一个管道脚本,以根据提交消息构建项目。从Jenkins的论坛,我注意到我们可以使用SCM跳过插件。我安装了该插件并按照论坛的建议添加了以下阶段:
scmSkip(deleteBuild: true, skipPattern:'.*\\[ci skip\\].*')
Run Code Online (Sandbox Code Playgroud)
当我使用以下提交消息提交更改时:
git commit -m "[ci skip] Updated Audit Test Data Files with scan status"
Run Code Online (Sandbox Code Playgroud)
不会跳过构建。它与其他阶段一起进展。
在控制台日志中,我看到消息
SCM 跳过:更改日志为空!
当发现包含“[ci Skip]”的提交消息时,如何构建 scmSkip 调用以跳过构建?是否有更容易实施的替代方案?
谢谢,卡蒂克·P。
jenkins jenkins-plugins jenkins-cli jenkins-groovy jenkins-pipeline
鉴于以下脚本:
function f {
[CmdletBinding()]Param()
Write-Verbose 'f: Start'
$t = New-Object 'System.Collections.ArrayList'
Write-Verbose $t.GetType().Name
return $t
}
$things = New-Object 'System.Collections.ArrayList'
$things.GetType().Name
$things = f -verbose
$things.GetType().Name
Run Code Online (Sandbox Code Playgroud)
为什么最后一行中的$thingsbe-of-type不会ArrayList?
鉴于以下 CloudFormation 模板片段:
AWSTemplateFormatVersion: 2010-09-09
Resources:
PrototypeCreateOrderFDM4:
Type: "AWS::Lambda::Function"
Properties:
CodeUri: "../Lambda/"
Handler: "PrototypeCreateOrder.handler"
Timeout: 15
Runtime: "nodejs10.x"
Role: arn:aws:iam::123456789012:role/deezNutz-Role-1ABC8DDEFGHI
Run Code Online (Sandbox Code Playgroud)
我收到一条警告说 CodeURI 不是一个有效的属性:
我有很多像这样的其他 Lambda 结构。我以前从来没有得到过这个。我错过了什么?
在连接到域的 Windows Server 2012 R2 机器上,我正在运行以下语句:
$target_machine_fqdn = [System.Net.Dns]::GetHostByName($env:computerName)
$certificate_request = Get-Certificate `
-Template 'AcmeComputer' `
-DnsName $target_machine_fqdn `
-CertStoreLocation 'Cert:\LocalMachine\My'
Run Code Online (Sandbox Code Playgroud)
我正在向域的 CA 请求主机证书。该语句返回没有错误。为机器生成证书并根据要求将其放置在“Cert:\LocalMachine\My”中。
问题:我不知道如何向服务帐户授予证书私钥的权限。
现在,大约有 1,000篇文章通过检索UniqueKeyContainerName以如下开头的代码来指导人们如何授予权限:
$certificate.PrivateKey.CspKeyContainerInfo.UniqueKeyContainerName
Run Code Online (Sandbox Code Playgroud)
这在这里行不通。虽然证书有私钥,但私钥数据成员为空:

在我刚刚逃避的解决方案有效的情况下,私钥在文件系统上。但是,在这种情况下,私钥位于以下注册表中:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\SystemCertificates\MY\Keys
Run Code Online (Sandbox Code Playgroud)
使用证书 MMC-snapin 时,我可以看到证书。我可以管理私钥的权限。所以,我知道它在那里。不幸的是,我需要自动分配权限,因此不能选择使用证书 MMC-snapin。我需要通过 Powershell 以某种方式执行此操作。
是否有关于在 AWS 中分离环境的最佳实践?
我有一个使用以下服务的解决方案:
我们还没有生活,但我们已经接近了。到我们上线时,我想要一个适当的生产、测试和开发环境,它们之间有“合理”的隔离度。
我阅读了Charity Majors的文章AWS 网络、环境和你。我对通过 VPC 进行分段感到失望,但我不知道我的堆栈中的所有服务都是 VPC 范围的?以下是我的一些要求:
我正在使用 AWS 组织。
PS 抱歉,如果这不是问题的正确论坛。如果有更好的东西,请告诉我,我会移动它。
powershell ×3
amazon-sns ×1
aws-glue ×1
aws-lambda ×1
cryptography ×1
jenkins ×1
jenkins-cli ×1
pester ×1
python ×1
traceback ×1
windows ×1