aws-samples / lambda-refarch-mobilebackend

Serverless Reference Architecture for creating a Mobile Backend
Apache License 2.0
587 stars 113 forks source link

Unable to Create AWS CloudFormation Stack with Template Two #5

Open ajantonov opened 9 years ago

ajantonov commented 9 years ago

The example doesn't generate Cloud Formation Stack and give the errors described below : (Thank for the response in advance)

Location : US East Template Two : https://s3.amazonaws.com/awslambda-reference-architectures/mobile-backend/lambdafunctions.template

Reported Errors : LambdaDynamoStreamsApiFunction Error occurred while getting the object from S3. S3 Error Code: NoSuchKey. S3 Error Message: The specified key does not exist.

LambdaMobileSearchApiFunction Error occurred while getting the object from S3. S3 Error Code: NoSuchKey. S3 Error Message: The specified key does not exist.

LambdaMobileCoreApiFunction Error occurred while getting the object from S3. S3 Error Code: NoSuchKey. S3 Error Message: The specified key does not exist.

Used Keys : "LambdaSourceBucket": { "Type": "String", "Description": "Name of S3 bucket where Lambda function packages are stored.", "Default": "awslambda-reference-architectures" },

    "LambdaMobileSearchS3Key": {
        "Type": "String",
        "Default": "mobile-backend/cloudsearchapi.zip",
        "Description": "Name of S3 key for ZIP with Lambda function package for querying CloudSearch."
    },
    "LambdaNotesApiS3Key": {
        "Type": "String",
        "Default": "mobile-backend/photonotesapi.zip",
        "Description": "Name of S3 key for ZIP with Lambda function package for sending mobile data to DDB."
    },
    "LambdaDynamoStreamsS3Key": {
        "Type": "String",
        "Default": "mobile-backend/searchstreams.zip",
        "Description": "Name of S3 key for ZIP with Lambda function package for sending data to CloudSearch."
    }
waleoladehin commented 9 years ago

Hi Anton,

Thank you for the message. Just to confirm, did you complete Step 4 from the Readme and upload the modified lambda functions into a new S3 bucket? The bucket in Step 4 will be a separate bucket in your account for holding your modified lambda functions, and will be a different bucket from the one created in Cloudformation template 1 that will hold images.

For each of the default keys in Cloudformation template 2:

You'll end up overriding and pointing to a bucket and set of keys created in your account from Step 3 and Step 4 of the Readme. Let me know if you have already created the bucket in your account and uploaded the source lambda functions, if so let me know what region you've created the bucket in and we can dive in a bit deeper from there.

Thanks!

ajantonov commented 9 years ago

Hi Waleoladehin,

Actually I decided to formulate the problem broadly. We don't know from where we can take these files you list in your message.

Best Regards, Anton

waleoladehin commented 9 years ago

Hi Anton,

Thanks for the reply. For the files you'll upload into your S3 bucket, you'll download them from the functions folder in github here:

https://github.com/awslabs/lambda-refarch-mobilebackend/tree/master/lambda-functions

From there, you'll configure the CloudSearch endpoint in both the search data and the note data lambda function index.js files to use the CloudSearch end point you'll configure in Step 2.

Once those are created and uploaded into S3, you'll use the bucket names and paths you've created as part of the input to Cloudformation template 2. Do let me know if that answered your question.

Thanks so much, Wale

allenchic commented 9 years ago

I got same error.

Have to create unique bucket. Key for each function will be whatever the filename is in the bucket for the function without the subdirectory "mobile-backend"

ajantonov commented 9 years ago

Hi waleoladehin,

My and samhotnumb problem is the same with bucket mobile-backend and files which we don't know where to take from.

Regards, Anton

allenchic commented 9 years ago

I got it to complete/build.

  1. I went in iOS project , in folder "lambda-functions" there are three folders notes-data-functions, search-data-functions, streams-data-functions which contain "index.js" . I updated the files based on previous instructions.
  2. zipped notes-data-functions, search-data-functions, streams-data-functions which created :notes-data-functions.zip, search-data-functions.zip, streams-data-functions.zip
  3. Create S3 bucket, uploaded notes-data-functions.zip, search-data-functions.zip, streams-data-functions.zip
  4. When you use template you will replace the default values for key with zip file names as appropriate and replace S3 bucket default with the bucket name you used.

waleoladehin , can you confirm this is correct?

waleoladehin commented 9 years ago

Hi samhotnumb,

Your notes below are correct. Those are the steps you would take to get the lambda functions into your S3 bucket and then use them as the values you'll enter in CloudFormation.

They make up steps 3 and 4 in the Readme, but that's exactly what you'll do. Really glad you got it working.

waleoladehin commented 9 years ago

Hi Anton,

For the S3 buckets, could you try the same naming convention samhotnumb used? You'll create two unique buckets; for example, mobileuploads-ajantonov and mobilelambda-ajantonov . The first bucket you'll use for uploads that will be sent from the mobile device; the second bucket will be used for uploading your Lambda functions that you'll create.

Once you've created each of the buckets above, you'll create the Lambda source code by downloading and modifying the lambda functions in the github repository here: https://github.com/awslabs/lambda-refarch-mobilebackend/tree/master/lambda-functions

You'll then be able to perform steps 3 and 4 in the Readme: https://github.com/awslabs/lambda-refarch-mobilebackend/blob/master/README.md, which is where you configure the Lambda functions to use your CloudSearch URL endpoint. Once those steps are complete you'll upload those functions into your S3 bucket (for example, mobilelambda-ajantonov) and then use that as the input into CloudFormation Template Two.

At a high level though, the functions you'll use are part of the github project, and once you configure them with the CloudSearch endpoint you can upload them into any S3 bucket you've created in your account. Those S3 buckets will be the ones you'll reference as you follow the Readme and deploy the CloudFormation templates.

Let me know if that clears things up. Thanks,

Wale