Catalin
Catalin

Reputation: 851

How to install Lambda function on AWS?

Ok, I'm new to working with Amazon Web Services and everything seems like a big mess and I'm not sure which way to go at this point.

What I'm trying to do is resize the images uploaded to a S3 bucket using a Lambda function. For this I have found an AWS Lambda Function to resize/reduce images automatically proper for my needs.

And this is the installation for it

$ git clone [email protected]:ysugimoto/aws-lambda-image.git
$ cd aws-lambda-image
$ npm install .

So I figured, first I should connect to AWS via SSH. For this I have followed the AWS tutorial: Setup Steps for SSH Connections to AWS CodeCommit Repositories on Windows

Which ended with a successful message, followed by an error, as expected: "You have successfully authenticated over SSH. You can use Git to interact to the AWS CodeCommit. Interactive Shells are not supported. FATAL ERROR: Server closed network connection"

What next, how can I actually install this Lambda function ?

How can I run commands like these, to configure said function $ cp config.json.sample config.json when interactive SSH connection is not allowed ? Any ideas or leads ? Am I doing it all wrong ?

Upvotes: 1

Views: 1018

Answers (2)

Panagiotis Kanavos
Panagiotis Kanavos

Reputation: 131364

I suspect you wanted to use a form of git-deployment and run the aws cli commands mentioned in the tutorials as post-commit hooks? CodeCommit offers only source control, without hooks or shell access, so it can't act as the packaging/deployment machine.

The easiest solution would be to use a local machine to do this, optionally cloning contents from CodeCommit or a local repository. There are tools to automate this like node-lambda or node-aws-lambda

The alternative, as mentioned in the comments, would be to create a small EC2 instance to act as the packaging machine.

Upvotes: 1

John Rotenstein
John Rotenstein

Reputation: 269340

The Tutorial: Using AWS Lambda with Amazon S3 shows how to implement a Lambda function to resize images upload into Amazon S3.

Also, as an alternative to resizing images, consider using dynamic-resizing services such as Cloudinary and Imgix.

Upvotes: 1

Related Questions