标签: amazon-sns

在shell脚本中向AWS SNS消息添加换行符

我想通过EC2中的shell脚本发送AWS SNS通知.以下是我的命令:

aws sns publish --topic-arn arn:aws:sns:x:x:x \
  --region=$AWS_DEFAULT_REGION \
  --subject "Processing Error - ${tablename}" \
  --message "An error has occurred in API data processing. The error file ${error_file} has been written to the errors folder...The file contents of ${error_file} are : $(cat ${error_file})"
Run Code Online (Sandbox Code Playgroud)

我的问题是我不知道在使用" cat"命令打印文件内容之前如何插入换行符?我想在换行后打印文件的内容.现在它被附加到"The file contents of ...".

如何在--message参数中添加换行符?

linux shell amazon-ec2 amazon-web-services amazon-sns

3
推荐指数
1
解决办法
2365
查看次数

当任何 aws lambda 函数超时时,我们可以附加 SNS 通知吗?

如果我的 lambda 函数出现任何错误或超时,我需要发送通知邮件。我在函数代码中以编程方式处理了错误,但无法在函数超时时发出通知。我准备好了我的 SNS 主题和所有内容。

任何人都可以请帮助解决这个问题。

javascript request-timed-out amazon-web-services amazon-sns aws-lambda

3
推荐指数
1
解决办法
767
查看次数

AWS SNS 传输到 AWS Lambda 的可靠性

从 AWS SNS常见问题页面(可靠性部分)我可以看到 SNS 保证至少一次将消息传送到 SQS,但不清楚在将通知发送到 Lambda 时是否同样适用。

那么问题是,当消息发送到 AWS Lambda 时,SNS 是否提供至少一次消息传递?

amazon-web-services amazon-sns aws-lambda

3
推荐指数
2
解决办法
4280
查看次数

使用 Python 进行 zappa 调度

我正在运行此代码以使用 Twilio 发送短信...

client.messages.create(
        to=form.phone.data, 
        from_="+1xxxxxxxxxx",
        body="This is a text message"
Run Code Online (Sandbox Code Playgroud)

我的应用程序使用 Python 的 Zappa 托管在 AWS Lambda 上。问题是我需要能够安排这条消息在未来 10 分钟内发送。

Zappa 提供任务执行,但他们的文档不清楚应该如何完成这样的事情。

谢谢您的帮助。

python twilio amazon-sns zappa aws-lambda

3
推荐指数
1
解决办法
2358
查看次数

使用 AWS SNS 的 Firebase 云消息传递

我正在尝试将 FCM 与 SNS 集成。我在这个答案中读到设置应该与 GCM 相同。我设法创建了一个 FCM 应用程序,并且可以向 Android 设备发送消息。当应用程序在后台时,设备会在托盘中收到通知,或者当应用程序在前台时打印收到的消息。我现在正在尝试将它集成到 SNS 中,但我似乎无法让它工作,没有任何错误消息。

在创建平台中,我应该使用哪个键?我使用了一种形式的 firebase 控制台-> 项目设置-> 云消息传递-> 服务器密钥 这是错误的吗?

对于平台端点,我使用 FCM 令牌作为设备令牌,在 firebase 控制台中发送通知时也使用该令牌。另外我应该在用户数据中放入什么,任何任意字符串都可以吗?

对于消息,我使用了 SNS 控制台中生成的 Json。FCM 是否接受与 GCM 不同的格式?

我错过了什么吗?

android amazon-web-services amazon-sns firebase firebase-cloud-messaging

3
推荐指数
1
解决办法
2665
查看次数

不同地区 AmazonIpSpaceChanged 的​​ SNS 订阅错误

为什么我无法在 AmazonIpSpaceChanged 上订阅 SNS?请检查,我需要你的指导。

我基本上遵循的指南是如何使用AWS 安全博客中的AWS Lambda 自动更新 Amazon CloudFront 和 AWS WAF 的安全组

这是终端的输出:

? 终端 $ cat ~/.aws/config
[默认]
区域 = ap-southeast-1
? 终端 $ aws sns subscribe --topic-arn arn:aws:sns:us-east-1:806199016981:AmazonIpSpaceChanged --protocol lambda --notification-endpoint arn:aws:lambda:ap-southeast-1:accountid_removed:function: cloudfront-安全组-控制器

调用订阅操作时发生错误 (InvalidParameter):无效参数:TopicArn
? 终端 $ AWS_REGION=ap-southeast-1 aws sns subscribe --topic-arn arn:aws:sns:ap-southeast-1:806199016981:AmazonIpSpaceChanged --protocol lambda --notification-endpoint arn:aws:lambda:ap-southeast -1:accountid_removed:function:cloudfront-securitygroup-controller

调用订阅操作时发生错误(AuthorizationError):用户:arn:aws:iam::accountid_removed:user/removed@gmail.com is not authorized to perform: SNS:Subscribe on resource: arn:aws:sns:ap-东南-1:806199016981:AmazonIpSpaceChanged

这也是通过 AWS Web 控制台完成时的输出:

User: arn:aws:iam::accountid_removed:user/removed@gmail.com is not authorized to perform: SNS:Subscribe on …
Run Code Online (Sandbox Code Playgroud)

amazon-web-services amazon-sns aws-lambda

3
推荐指数
1
解决办法
3530
查看次数

Amazon SNS:如何获取令牌以确认订阅

以下创建一个等待确认的订阅。

aws_client.subscribe(TopicArn=topic_arn, Protocol=protocol, Endpoint=endpoint)
Run Code Online (Sandbox Code Playgroud)

对此的回应是这样的:

{'ResponseMetadata': {'HTTPHeaders': {'content-length': '298',
   'content-type': 'text/xml',
   'date': 'Fri, 13 Oct 2017 10:15:47 GMT',
   'x-amzn-requestid': '7a0a40fb-ab72-5584-94f0-12a13fe11das'},
  'HTTPStatusCode': 200,
  'RequestId': '7a0a40fb-ab72-5584-94f0-12a13fe11das',
  'RetryAttempts': 0},
 u'SubscriptionArn': 'pending confirmation'}
Run Code Online (Sandbox Code Playgroud)

上面的响应没有发送任何令牌。如何获得这可以传递给confirm_subscription如规定的令牌这里

boto amazon-sns python-2.7

3
推荐指数
1
解决办法
2779
查看次数

AWS Lambda SNS 触发事件类型?

我已经做了一段时间的无服务器开发,主要是 AWS,并且刚刚开始进入 SNS 发布/订阅设计模式。我正在使用打字稿,并且类型支持非常好,但是我无法为从 SNS 或 S3 触发器传入 Lambda 的事件找到正确的类型。这些确实会使功能之间的接缝非常安全。目前我正在定义我自己的接口,但这会让人厌烦。例如

interface IAWSSNSTriggerPayload {
  Records: [
    {
      EventSource: string,
      EventVersion: string,
      EventSubscriptionArn: string,
      Sns: {
        Type: string,
        MessageId: string,
        TopicArn: string,
        Subject: string,
        Message: string,
        Timestamp: string,
        SignatureVersion: string,
        Signature: string,
        SigningCertUrl: string,
        UnsubscribeUrl: string,
        MessageAttributes: {},
      }
    }
  ]
}

export const handler = (event: IAWSSNSTriggerPayload, context, cb) => {
  const response = {
    statusCode: 200,
    body: JSON.stringify({
      message: 'Go Serverless Webpack (Typescript) v1.0! Your function executed successfully! And from …
Run Code Online (Sandbox Code Playgroud)

amazon-web-services amazon-sns typescript aws-lambda serverless

3
推荐指数
1
解决办法
3767
查看次数

3
推荐指数
3
解决办法
8882
查看次数

How to write SNS topic into CloudWatch log within AWS console?

I set up an email address within SES and I added SNS topic to the notifications sections.

SES主题

I can then subscribe to the SNS topic via email and I will receive the notifications but is there an easy way for me to write these notifications into CloudWatch logs within the console?

amazon-web-services amazon-sns amazon-ses amazon-cloudwatch amazon-cloudwatchlogs

3
推荐指数
1
解决办法
3295
查看次数