1

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 ?

5
  • AWS CodeCommit has no relation at all to anything you are trying to do here. Those installation steps are only the first part of the steps you need to perform. You need to create an AWS EC2 server running Amazon Linux and SSH into THAT server and then perform all the steps to download, compile and package the Lambda function. Then get the zip file off that server and upload it to the AWS Lambda service. Commented Apr 8, 2016 at 1:30
  • @Mark B Wow. But shouldn't a Lambda function be used without the need of a EC2 server ? Isn't that the whole idea ? Commented Apr 8, 2016 at 1:42
  • It doesn't run on an EC2 server, but you haven't even gotten to the point of running the function on Lambda yet. You still need to build and package the function and upload it to Lambda, and since your function requires certain packages only available on Amazon Linux, you need to create an Amazon Linux server to build it. Commented Apr 8, 2016 at 1:45
  • The link you posted gives instructions on how to configure and build the Lambda app. After it is built, you need to create a Lambda function, and upload this app that was just created. To finalize, you would need to link the Lambda function to be executed upon a new event -- specifically the event of uploading a file to a specific S3 bucket. This question shows a lack of research. To start, I'd suggest looking into "How to create a Lambda Function", and then "Lambda Event Source S3". Commented Apr 8, 2016 at 8:42
  • 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 Commented Apr 12, 2016 at 9:51

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

Comments

1

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.

1 Comment

That link doesn't answer the OP's question - how to deploy a Lambda from source control. A proper answer would be "you need to execute these shell commands, using aws cli"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.