我正在尝试从 SNS codestar-notifications 为 AWS lambda 创建触发器
。
使用控制台创建触发器时,它会自动添加对 SNS 主题的订阅。
。此外,这也可以在另一个方向上工作,即如果我通过显式添加其 arn 来创建 SNS 作为 Lambda 函数的订阅,它会自动将触发器链接到 Lambda 函数。
但是当使用 terraform 创建订阅时,如下所示:
resource "aws_sns_topic_subscription" "subscribe_lambda_to_first_topic" {
topic_arn = module.first_topic.sns-topic-detail.arn
protocol = "lambda"
endpoint = module.lambda_function.lambda_function.arn
}
Run Code Online (Sandbox Code Playgroud)
它不会在 AWS Lambda 中创建触发器。
我尝试使用 Terraform 中的事件源映射创建触发器,如下所示
resource "aws_lambda_event_source_mapping" "lambda_source" {
event_source_arn = module.first_topic.sns-topic-detail.arn
function_name = module.lambda_function.lambda_function.arn
starting_position = "LATEST"
}
Run Code Online (Sandbox Code Playgroud)
它向我抛出一个错误,说它只能用于
错误:创建 Lambda 事件源映射时出错(arn:aws:sns:us-west-2:619867110810:codestar-notifications-emc-sns-to-lambda):InvalidParameterValueException:无法识别的事件源,必须是 kinesis、dynamodb 流或 sqs 。不支持的源 arn : arn:aws:sns:us-west-2:619867110810:codestar-notifications-emc-sns-to-lambda { RespMetadata: { StatusCode: 400, RequestID: "83bf57cb-b50d-49a8-9547-72fac69778d1" },Message_:“无法识别的事件源,必须是 kinesis、dynamodb 流或 sqs。不支持的源 …
amazon-web-services amazon-sns aws-lambda terraform terraform-provider-aws
我有一个简单的地形配置,如下所示。
\n# Terraform settings Block\nterraform {\n required_version = "~> 1.0.0"\n required_providers {\n azurerm = {\n source = "hashicorp/azurerm" # https://registry.terraform.io/providers/hashicorp/azurerm/latest\n version = "~> 3.0"\n }\n }\n}\n\nprovider "azurerm" {\n features { }\n}\n\nresource "azurerm_resource_group" "rg" {\n name = var.resource_group_name\n location = var.resource_group_location\n}\nRun Code Online (Sandbox Code Playgroud)\n当我跑步时
\nterraform init\nRun Code Online (Sandbox Code Playgroud)\n我收到以下错误。
\n\xe2\x95\xb7\n\xe2\x94\x82 Error: Unsupported Terraform Core version\n\xe2\x94\x82\n\xe2\x94\x82 on main.tf line 3, in terraform:\n\xe2\x94\x82 3: required_version = "~> 1.0.0"\n\xe2\x94\x82\n\xe2\x94\x82 This configuration does not support Terraform version 1.2.2. To proceed, either choose another supported …Run Code Online (Sandbox Code Playgroud) 我有一个简单的例子,Entry和三个独立的框架.
from tkinter import *
top = Tk()
Entry(top, width="20").pack()
Frame(top, width=200, height=200, bg='blue').pack()
Frame(top, width=200, height=200, bg='green').pack()
Frame(top, width=200, height=200, bg='yellow').pack()
# Some extra widgets
Label(top, width=20, text='Label text').pack()
Button(top, width=20, text='Button text').pack()
top.mainloop()
Run Code Online (Sandbox Code Playgroud)
一旦我开始在Entry中写入,键盘光标就会停留在那里,即使我用鼠标按下蓝色,绿色或黄色框架.当鼠标按下另一个小部件时,如何停止在Entry中写入?在这个例子中只有三个小部件,除了Entry.但是假设有很多小部件.
我可以通过选中复选框 ( https://ibb.co/bWDLcNT )在 AWS 控制台中手动启用(S3 存储桶的请求指标,apid 选项)。但我试图通过代码来做到这一点。我尝试寻找使用 CloudFormation / CDK(nodeJs) / AWS CLI 的解决方案。但没有运气。我找到的解决方案只涉及使用过滤器等创建指标,而不是启用它。有什么建议吗?
amazon-s3 amazon-web-services aws-cloudformation amazon-cloudwatch aws-cdk
"The event is not supported for notifications (Service: Amazon S3; Status Code: 400; Error Code: InvalidArgument; Request ID: CF3108325F3C9B60; S3 Extended Request ID: wcWzRXUu7YJn/BVnPDtOx7yBHllhIPELEwsTweqVcfwLw1hkR2iDiSmQbxeL3Hrtp7Kv58ujS2s=; Proxy: null)"
Run Code Online (Sandbox Code Playgroud)
请参阅以下来自 AWS Mgm 控制台的 CloudFormation 事件:
下面是我的 AWS SAMtemplate.yaml文件:
AWSTemplateFormatVersion: '2010-09-09'
Transform: 'AWS::Serverless-2016-10-31'
Description: An AWS Serverless Specification template describing your function.
Resources:
olatexOrdersInputDirectory:
Type: 'AWS::S3::Bucket'
olatexXlsxOrderLoader:
Type: 'AWS::Serverless::Function'
Properties:
Handler: olatexXlsxOrderLoader/index.handler
Runtime: nodejs12.x
Description: ''
MemorySize: 128
Timeout: 15
Policies:
- AWSLambdaBasicExecutionRole
- …Run Code Online (Sandbox Code Playgroud) amazon-s3 amazon-web-services aws-cloudformation serverless-application-model
当我尝试使用 terraform 创建子网时,我不断收到以下错误。使用 aws 控制台创建子网没有问题。有人可以帮助我吗?
Error: error creating subnet: InvalidSubnet.Range: The CIDR '192.168.1.0/24' is invalid.
status code: 400
Run Code Online (Sandbox Code Playgroud)
创建 VPC 的代码:
resource "aws_vpc" "vpc_worker" {
provider = aws.region-worker
cidr_block = "198.168.0.0/16"
enable_dns_support = true
enable_dns_hostnames = true
tags = {
Name = "master-vpc-jenkins"
}
}
Run Code Online (Sandbox Code Playgroud)
创建子网的代码:
#Create subnet in us-west-2
resource "aws_subnet" "subnet_1_worker" {
provider = aws.region-worker
vpc_id = aws_vpc.vpc_worker.id
cidr_block = "192.168.1.0/24"
}
Run Code Online (Sandbox Code Playgroud)
地形版本:0.12.29
提前致谢。
amazon-web-services terraform terraform-provider-aws terraform0.12+
我尝试根据 IAM 角色是否存在来设置 KMS 密钥策略。yaml 文件如下所示。
data "aws_iam_policy_document" "key_policy" {
statement {
sid = "Give Access to the my Role"
actions = [
"kms:GenerateDateKey",
"kms:Decrypt"
]
resources = ["*"]
principals {
type = "AWS"
identifiers = ["arn:aws:iam::${var.account_id}:role/myrole"]
}
}
}
Run Code Online (Sandbox Code Playgroud)
此 terraform 脚本的问题是,如果myrole我的帐户中不存在该脚本,它将失败。我们有多个 AWS 账户,但其中只有一部分有这个myrole。我们的 CI 将为所有帐户运行相同的脚本。有没有办法仅在存在时应用此语句myrole?
我将通过 EC2 中的requirements.txt 安装 pyaudio 和 sounddevice 软件包。但它说raise OSError('PortAudio library not found')
所以我尝试为声音设备安装 libasound-dev...
Yum install libasound-dev
Run Code Online (Sandbox Code Playgroud)
但它也说:
No package libasound-dev available
Run Code Online (Sandbox Code Playgroud)
我应该怎么做?我在AWS EC2中。
我正在构建一个在图像处理方面类似于 Instagram 的移动应用程序。我使用 amazon s3 来存储图像,并使用 Mysql 作为文件路径。我试图确保用户上传高质量的图片,但也确保文件大小合理,我应该压缩图像吗?有谁知道图像可接受的尺寸是多少?
我一直在尝试弄清楚如何使用 Terraform 创建具有自定义名称的应用程序负载均衡器。到目前为止我有这个:
\nresource "aws_alb" "application_load_balancer" {\n name = "${var.brand}-be-${var.environment_name}-load-balancer"\n tags = local.tags\n load_balancer_type = "application"\n subnets = data.aws_subnets.public_subnets.ids\n\n # security group\n security_groups = [aws_security_group.sg_load_balancer.id]\n}\n\n# Hosted Zone for new-dev.foocorp.com\nresource "aws_route53_zone" "zone_dev" {\n name = "new-dev.foocorp.com"\n comment = "Hosted Zone for new-dev.foocorp.com"\n records = [ aws_alb.application_load_balancer.dns_name ]\n\n tags = merge(local.tags, {\n Name = "new-dev.foocorp.com"\n })\n}\nRun Code Online (Sandbox Code Playgroud)\n但是,我得到:
\n\xe2\x95\xb7\n\xe2\x94\x82 Error: Unsupported argument\n\xe2\x94\x82 \n\xe2\x94\x82 on main.tf line 323, in resource "aws_route53_zone" "zone_dev":\n\xe2\x94\x82 323: records = [ aws_alb.application_load_balancer.dns_name ]\n\xe2\x94\x82 \n\xe2\x94\x82 An argument …Run Code Online (Sandbox Code Playgroud) amazon-web-services terraform terraform-provider-aws aws-application-load-balancer
terraform ×5
amazon-s3 ×3
amazon-ec2 ×1
amazon-iam ×1
amazon-kms ×1
amazon-sns ×1
asp.net-core ×1
aws-application-load-balancer ×1
aws-cdk ×1
aws-lambda ×1
azure ×1
c# ×1
python ×1
serverless-application-model ×1
tkinter ×1