我有4个lambda函数,将同时调用(由SNS),SNS事件的频率为5分钟.每个函数处理大量数据和图像(~300MB),因此我将它们存储在/tmp文件夹中(500MB限制).
在函数开始时,我在清理/tmp文件夹中写了一些代码,以确保它不会内存不足(因为我已经知道AWS lambda有时会重用以前的容器来提高性能).
我手动检查它(创建消息并通过SNS发布到4个lambda函数),它工作正常.
但是当它自动运行(每5分钟调用一次)时,结果并不像我期望的那样.第一次执行很好,但接下来的时间,4个甚至4个lambda函数中的1个抛出与"内存不足"相关的错误:"设备上没有空间",无法加载lib,...
以前,我使用nodejs(4.3)它两种情况都很好.
但由于某种原因我必须更改为python,主流和创建数据的挂载是相同的.但它在自动运行时失败了.
我认为这个问题来自前一个容器(重用容器)的缓存,我检查了/tmpclean(ls -alh /tmp)之后没有文件但是当检查存储(df /tmp)时它显示使用的是77%.
任何关于制作干净/tmp文件夹或解决方案的建议都非常感谢.谢谢!
编辑:我用来清理/tmp文件夹的代码:
from subprocess import call
...
call('rm -rf /tmp/*', shell=True)
Run Code Online (Sandbox Code Playgroud) 我想在亚马逊认知用户确认后重定向到特定网址.
当用户注册时,他将收到带有验证链接的确认邮件,如下所示 :https:// <> .auth.us-west-2.amazoncognito.com/confirmUser?client_id = << >>&user_name = << >>&confirmation_code = << >>
如果用户点击上述链接,它将重定向到确认页面.
用户确认完成后,页面应重定向到我的应用程序.
请给我一些解决这个问题的想法.
我需要使用相应的键将字符串附加到dynamodb表中的字符串集.这是我用来执行updateItem的Update表达式:
var params = {
"TableName" : tableName,
"Key": {
"ID": {
S: "20000"
}
},
"UpdateExpression" : "SET #attrName = list_append(#attrName, :attrValue)",
"ExpressionAttributeNames" : {
"#attrName" : "entries"
},
"ExpressionAttributeValues" : {
":attrValue" : {"SS":["000989"]}
} };
Run Code Online (Sandbox Code Playgroud)
这在我使用aws cli执行updateItem()时有效.但是当在nodejs中使用aws-sdk时,我收到错误:
Invalid UpdateExpression: Incorrect operand type for operator or function; operator or function: list_append, operand type: M\n
Run Code Online (Sandbox Code Playgroud)
有帮助吗?谢谢
我正忙着使用aws-sdk文档,我所遵循的所有链接都显得过时且无法使用.
我正在寻找一个直接的实现示例,将图像文件上传到Ruby中的S3存储桶.
screenshots/image.pngmy_bucket任何建议都非常感谢.
调用assume roleSTS方法时出错.它表示用户无权sts:AsumeRole在资源上执行xxx.
我做了以下事情:
我究竟做错了什么?
集团政策
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "some-large-id",
"Effect": "Allow",
"Action": [
"sts:*"
],
"Resource": [
"*"
]
}
]
}
Run Code Online (Sandbox Code Playgroud)
角色政策
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "another-large-id",
"Effect": "Allow",
"Action": [
"s3:PutObject"
],
"Resource": [
"arn:aws:s3:::my-bucket-name/*"
]
}
]
}
Run Code Online (Sandbox Code Playgroud)
最后这样打电话
let policy = {
"Version": "2012-10-17",
"Statement": [
{
"Sid": "new-custom-id",
"Effect": "Allow",
"Action": ["s3:PutObject"],
"Resource": ["arn:aws:s3:::my-bucket-name/*"] …Run Code Online (Sandbox Code Playgroud) 当我尝试在本地运行Spring boot-AWS应用程序时,我收到以下错误:
没有可用的EC2元数据,因为应用程序未在EC2环境中运行.仅当应用程序在EC2实例上运行时,才能进行区域检测
我的aws-config.xml如下所示:
<aws-context:context-credentials>
<aws-context:simple-credentials access-key="*****" secret-key="*****"/>
</aws-context:context-credentials>
<aws-context:context-region auto-detect="false" region="ap-south-1" />
<aws-context:context-resource-loader/>
<aws-messaging:annotation-driven-queue-listener max-number-of-messages="10" wait-time-out="20" visibility-timeout="3600"/>
Run Code Online (Sandbox Code Playgroud)
我正在尝试使用以下类中的SQSListner进行监听:
@Configuration
@EnableSqs
@ImportResource("classpath:/aws-config.xml")
@EnableRdsInstance(databaseName = "******",
dbInstanceIdentifier = "*****",
password = "******")
public class AwsResourceConfig {
@SqsListener(value = "souviksqs", deletionPolicy = SqsMessageDeletionPolicy.ON_SUCCESS)
public void receiveNewFileUpload(S3EventNotification event) {
try {
if ( event != null && !CollectionUtils.isNullOrEmpty( event.getRecords() ) && event.getRecords().get( 0 ) != null ) {
S3Entity entry = event.getRecords().get(0).getS3();
System.out.println("############ File Uploaded to ###################### " + entry.getBucket().getName() + "/" + …Run Code Online (Sandbox Code Playgroud) 使用AWS SDK for JavaScript,我想使用一个承担角色的默认配置文件.这与AWS CLI完美配合.将node.js与SDK一起使用不承担该角色,而只使用访问密钥所属的AWS账户的凭据.我找到了这个文档,但它没有涉及假设一个角色:http://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/loading-node-credentials-shared.html
有小费吗?
这是我的配置文件:
[default]
role_arn = arn:aws:iam::123456789:role/Developer
source_profile = default
output = json
region = us-east-1
Run Code Online (Sandbox Code Playgroud) 我正在使用AWS API Gateway和自定义域.当我尝试访问https://www.mydomain.com时,它运行正常,但是当我尝试http://www.mydomain.com时它无法连接.
有没有办法http -> https在API网关中重定向自定义域?如果没有,有没有办法让http://链接像https://链接一样工作?
我正在尝试将Amazon Push Notifications集成到我的iPhone应用程序中.我确实按照这里提供的教程.
创建Platform EndPoint时出现此错误.(似乎身份池的权限问题???)
CognitoIdentityCredentials is not authorized to perform: SNS:CreatePlatformEndpoint
Run Code Online (Sandbox Code Playgroud)
完整信息:
Error: Error Domain=com.amazonaws.AWSSNSErrorDomain Code=4 "The operation couldn’t be completed. (com.amazonaws.AWSSNSErrorDomain error 4.)" UserInfo=0x165dcef0 {Type=Sender, Message=User: arn:aws:sts::290442422498:assumed-role/Cognito_Laugh_DevUnauth_Role/CognitoIdentityCredentials is not authorized to perform: SNS:CreatePlatformEndpoint on resource: arn:aws:sns:us-east-1:290442422498:app/APNS_SANDBOX/Laugh, __text=(
"\n ",
"\n ",
"\n ",
"\n "
), Code=AuthorizationError}
Run Code Online (Sandbox Code Playgroud)
码
AWSRegionType const CognitoRegionType = AWSRegionUSEast1;
AWSRegionType const DefaultServiceRegionType = AWSRegionUSEast1;
NSString *const CognitoIdentityPoolId = @"us-east-1:0..................";
NSString *const SNSPlatformApplicationArn = @"arn:aws:sns:us-east-1:................";
NSString *const MobileAnalyticsAppId = @"YourMobileAnalyticsAppId";
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions …Run Code Online (Sandbox Code Playgroud) 我正在使用AWS EC2 Ubuntu Machine并尝试从AWS S3获取图像,但每次都向我显示以下错误.
<Error>
<Code>InvalidArgument</Code>
<Message>
Requests specifying Server Side Encryption with AWS KMS managed keys require AWS Signature Version 4.
</Message>
<ArgumentName>Authorization</ArgumentName>
<ArgumentValue>null</ArgumentValue>
<RequestId>7C8B4BF1CE2FDC9E</RequestId>
<HostId>
/L5kjuOET4XFgGter2eFHX+aRSvVm/7VVmIBqQE/oMLeQZ1ditSMZuHPOlsMaKi8hYRnGilTqZY=
</HostId>
</Error>
Run Code Online (Sandbox Code Playgroud)
这是我的桶政策
{
"Version": "2012-10-17",
"Id": "Policy1441213815928",
"Statement": [
{
"Sid": "Stmt1441213813464",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::mytest.sample/*"
}
]
}
Run Code Online (Sandbox Code Playgroud)
这是代码
require 'aws-autoloader.php';
$credentials = new Aws\Credentials\Credentials('key', 'key');
$bucketName = "mytest.sample";
$s3 = new Aws\S3\S3Client([
'signature' => 'v4',
'version' => 'latest',
'region' => …Run Code Online (Sandbox Code Playgroud) aws-sdk ×10
node.js ×4
amazon-s3 ×2
amazon-ec2 ×1
amazon-iam ×1
amazon-sns ×1
aws-cognito ×1
aws-lambda ×1
ios ×1
objective-c ×1
php ×1
python ×1
ruby ×1
spring-boot ×1