Tags down


Not able to add S3 as destination in lambda

By : Sajeesh Kumar
Date : September 15 2020, 10:00 AM
may help you . You cannot use s3 directly as a destination from your lambda. Destination can be an SQS queue, SNS topic, Lambda function, or EventBridge event bus.
What you can do in order to store data to s3 from your lambda is to do that through your code inside lambda.
code :

Share : facebook icon twitter icon

Amazon Lambda function merge multiple s3 images and put to a destination bucket

By : Wonderboy
Date : March 29 2020, 07:55 AM
I hope this helps you . Ok looks like it would be difficult to achieve what I was looking as explained into the question above. However after doing several try and different modules none of the try worked. As explained the purpose of the lambda function is
code :
* This is a test script which runs as a lambda function on amazon 
* The lamda function is linked with an amazon end point
* The script will accept a image url (facebook/gravator) etc and will upload to a destination s3 bucket and returns the url 
* The param looks like 

var exec = require('child_process').exec,
    async = require('async'),
    request = require('request'),
    gm = require('gm').subClass({ imageMagick: true }),
    fs = require('fs'),
    aws = require('aws-sdk');

exports.handler = function(req, context) {
    var errMsg = '',
        userProfileImageName = 'user_profile',
        friendProfileImageName = 'friend_profile',
        mergedImageName = 'final_image',
        destinationBucket = 'mybucket',
        response = {} ,
        s3 = new aws.S3();

    if (req.userProfileImagePath === '') {
        errMsg = 'Missing the userProfileImage';

    if (req.friendProfileImagePath === '') {
        errMsg = 'Missing the friendProfileImagePath ';

    if (errMsg === '') {
            copyUserImage : function(autoCallback) {
                    url: req.userProfileImagePath,
                    encoding: null
                }, function(err, res, body) {
                    if (err) { return autoCallback(err); }

                    fs.writeFile('/tmp/'+userProfileImageName+'.jpg', body, 'binary', function(err) {
                        if(err) { return autoCallback(err); }

                        return autoCallback();

            copyFriendImage : function(autoCallback) {
                    url: req.friendProfileImagePath,
                    encoding: null
                }, function(err, res, body) {
                    if (err) { return autoCallback(err); }  

                    fs.writeFile('/tmp/'+friendProfileImageName+'.jpg', body, 'binary', function(err) {
                        if(err) { return autoCallback(err); }

                        return autoCallback();

            mergeImages : ['copyUserImage','copyFriendImage', function(autoCallback,results) {
                var bgImage = '/tmp/'+userProfileImageName+'.jpg',
                    frontImage = '/tmp/'+friendProfileImageName+'.jpg';

                .in('-page', '+0+0')  // Custom place for each of the images
                .in('-page', '+140+50')
                .mosaic()  // Merges the images as a matrix
                .drawText(1, 1, 'Hello World', 'Center')
                .drawText(0, 0, 'Hello World', 'Center')
                .write('/tmp/'+mergedImageName+'.jpg', function (err) {
                        if (err) { return autoCallback(err); }

                        var stream = fs.createReadStream('/tmp/'+mergedImageName+'.jpg');
                        var stats = fs.statSync('/tmp/'+mergedImageName+'.jpg');
                        console.log('Merged File size :'+stats['size']);
                            Bucket: destinationBucket,
                            Key: mergedImageName+'.jpg',
                            ContentType: 'image/jpeg',
                            ContentLength: stats['size'],
                            Body: stream, // buffer
                    }, autoCallback);   
        function(err, results) {
            if (err) {
                response = {
                    "msg":"Error manipulating the image :: "+err 
                } ;
            } else {
                response = {
                } ;
    } else {
        response = {
            "msg": errMsg
        } ;

S3 Bucket Lambda Event: Unable to validate the following destination configurations

Date : March 29 2020, 07:55 AM
wish help you to fix your issue You are getting this message because your s3 bucket is missing permissions for invoking your lambda function.
According to AWS documentation! there are two types of permissions required:
code :
  "Version": "2012-10-17",
  "Id": "default",
  "Statement": [
      "Sid": "<optional>",
      "Effect": "Allow",
      "Principal": {
        "Service": "s3.amazonaws.com"
      "Action": "lambda:InvokeFunction",
      "Resource": "<ArnToYourFunction>",
      "Condition": {
        "StringEquals": {
          "AWS:SourceAccount": "<YourAccountId>"
        "ArnLike": {
          "AWS:SourceArn": "arn:aws:s3:::<YourBucketName>"

How to set destination as lambda in cloudformation for aws kinesis data analytics

By : venkatesh BADIGER
Date : March 29 2020, 07:55 AM
should help you out I noticed it is not supported to directly connect analytics to lambda via cloud-formation so the way to fix it is to use another stream as an brifge

AWS Lambda w/ SQS trigger, SQS Lambda Destinations, never adds to destination queue

By : user3570477
Date : March 29 2020, 07:55 AM
Does that help Destinations will not be triggered if you invoke the Lambda function synchronously. You can read this article to get a better idea.
The primary use case of Destinations is to know about the async execution results of Lambda functions, primarily to get more visibility into the execution details like request and response contexts, payloads, exception stack traces etc. So if a Lambda was invoked synchronously (say, using cli or via an SQS trigger), no messages will be delivered to the Destinations endpoints.

Destination only works when Lambda is invoked through AWS CLI

By : user3635235
Date : March 29 2020, 07:55 AM
help you fix your problem It seems there is a set of valid {trigger, destination} pairs, and {API Gateway, SQS} is not one of them. Being able to invoke the lambda from a given trigger is not sufficient to get the event passed along to the destination. AWS console doesn't enforce these pairing or raise warnings.
I referenced the chart from: https://www.trek10.com/blog/lambda-destinations-what-we-learned-the-hard-way/
Related Posts Related Posts :
  • AWS Lambda times out when trying to connect to sqs
  • packer provisioning by ansible fails in aws codebuild
  • Good way to whitelist ingress traffic for JHub on EKS (AWS kubernetes)?
  • Can Amazon EC2 Reserved Instance be cancelled and get a refund?
  • Will an Amazon EC2 instance automatically refresh its own IP at some time interval?
  • Codebuild with SAM CLI Cross Account S3 issue
  • Cannot access ports in AWS ECS EC2 instance
  • chickens and eggs in AWS S3 CloudFront deployment with Route 53 and ACM
  • While hosting at major players like AWS or Azure or Google Cloud, can I trust that my code and table structures wont be
  • AWS CodeBuild - copy yaml file to S3 after successful build
  • Best practics working docker-compose on AWS ECS for Continuos Deploy
  • Does CloudFormation expose the Reader Endpoint of a Redis ElastiCache Replication Group?
  • moving heroku db to RDS
  • Prevent certain AWS AMI from accidental deletion
  • Amazon S3 Bucket cache clear
  • How to use AWS ECS to get Database secrets from Parameter Store
  • How to deploy multiple stack with one template in cloudformation
  • Why does SQS fail to process these messages?
  • How to change storage class In S3 the fastest way
  • AWS RDS Certificate Authority update
  • AWS SQS operations in lambda takes too long on cold start
  • When should I use auto-scaling and when to use SQS?
  • If you are using AWS to autoscale spot instances of your application, how do you handle logging?
  • Is it possible to generate two secret strings in one CloudFormation SecretsManager secret?
  • Trigger Lambda function when S3 buckets get created
  • Getting ImagePullBackOff on EC2 instance while creating Kubernetes pods
  • Why does an AWS EC2 have multiple folders under /var/lib/cloud/instances/ with different instance_ids?
  • Pinpoint FCM push notification status "Successful" but not received in console/device
  • How can I monitor AWS S3 access by user?
  • AWS DynamoDB Backwards Scanning Ignores LastEvaluatedKey
  • AWS Codebuild | Docker | Unable to pull customer's container image | a Windows version 10.0.17763-based image is incompa
  • AWS DMS - Database Migration Service SYSTEM ERROR MESSAGE:The IAM Role arn:aws:iam::<account_id>:role/dms-vpc-role
  • Changes made via SSH WILL BE LOST if the instance is replaced by auto scaling
  • How should you deploy a combination of serverless and non-serverless resources in AWS?
  • Clarifications on serving non website S3 bucket via CloudFront as web site
  • Share outputs from CloudFormation nested stack
  • persistent storage solutions for aws fargate
  • Understand Amazon S3 Bucket permissions
  • Pointing multiple Route53 subdomains to a single S3 bucket
  • Instances created recently by AWS ECS do not have ssh authorized_keys configured
  • How to add ec2 instance in aws ecs empty cluster
  • AWS CloudFormation drop down for IAM Role
  • Deploy latest image from ECR to EC2
  • How to disable (or redirect) logging on an AWS Step Function that calls parallel Lambda functions
  • Multiple docker containers and scallinguUp with AWS
  • does lambda layer include aws-sdk
  • How to optimize download speeds from AWS S3 bucket?
  • How do I create a role with AWS managed policy using aws-cli?
  • How pass output values between aws nested stacks in serverless?
  • Splunk migration to S3 DataLake
  • How can I change name of my Lambda Functions API endpoint
  • AWS Cognito AdminLinkProviderForUser - User Pool Account and Facebook
  • What does public subnet mean in AWS VPC?
  • AWS CodeBuild DOWNLOAD_SOURCE failed
  • How to find the cache location for AWS Secrets Manager
  • Symfony 4, Doctrine and AWS RDS read replica usage
  • Lambda boto3 background functions with api
  • AWS amplify auth How to remove redirect uri
  • Application deployed only in Private Subnet
  • Why traceroute ignores route table in AWS EC2 with VPC
  • shadow
    Privacy Policy - Terms - Contact Us © 35dp-dentalpractice.co.uk