In case you hadn’t noticed already, I have recently been the I suffered when trying to get started with the . While the blame for most of those stupid mistakes is on my own laziness, over-esteem and lack of attention to detail, I personally felt that getting started with a leading serverless provider should not have been hard. babbling about pitfalls official AWS lambda-S3 example that ) (https://previews.123rf.com/images/inspirestock/inspirestock1402/inspirestock140202784/26145257-businessman-banging-his-head-against-the-wall.jpg And so did my team at . And we built to make it a reality. SLAppForge Sigma Sigma Let’s see what Sigma could do, to . make your serverless life easy Sigma already comes with a of the S3 thumbnailing sample. Deploying it should take just a few minutes, as per the , if you dare. ready-made version Readme In this discussion, let’s take a more hands-on approach: grabbing the code from the , pasting it into Sigma, and — the exact same thing that got me , the last time I tried. original thumbnailing sample deploying it into AWS running around the block , Sigma manages much of the “behind the scenes” stuff regarding your app — including function permissions, and related — on your behalf. This relies on certain syntactic guidelines being followed in the code, which — luckily — are quite simple and ordinary. So all we have to do is to grab the original source, paste it into Sigma, and make some adjustments and stuff — and Sigma will understand and handle the rest. As you may know trigger configurations resources drag-and-drop configuration If you haven’t already, now is a great time to so that we could start inspiring you with the awesomeness of serverless. (Flattery aside, you need a Sigma account in order to access the .) Have a look at to get going. sign up for Sigma do IDE this small guide Sigma: create an account Once you’re in, just copy the and shove it down Sigma’s throat. S3 thumbnail sample code from AWS docs S3 thumbnail sample code from AWS docs, pasted into Sigma The editor, which would have been rather plain and boring, would now start showing some specks of interesting stuff; especially on the left border of the . editor area Code comes to life: operation and trigger indicators on left border The lightning sign at the top (against the function header with the highlighted variable) indicates a ; an invocation (entry) point for the function. While this is not a part of the function itself, it should nevertheless be properly configured, with the necessary source (S3 bucket), destination (lambda function) and permissions. event trigger lambda Trigger indicator: still red (unconfigured) Good thing is, with Sigma, you only need to indicate the ; Sigma will take care of the rest. source (S3 bucket) configuration At this moment the lightning sign is red, indicating that . Simply drag a from the left pane on to the above line (function header) to indicate to Sigma that this lambda should be triggered by an . a trigger has not been configured entry S3 S3 event Dragging a S3 entry As soon as you do the drag-and-drop, Sigma will ask you about the missing pieces of the puzzle: namely the , and the nature of the operation that should trigger it; which, in our case, is the for image files. S3 bucket which should be the trigger point for the lambda “object created” event S3 trigger pop-up When it comes to specifying the source bucket, Sigma offers you two options: you could either select an existing bucket via the drop-down list ( tab), or Existing Bucket define a new bucket name via the tab, so that Sigma would create it afresh as part of the project deployment. New Bucket Since the “image files” category involves several file types, we would need to define multiple triggers for our lambda, each corresponding to a different file type. (Unfortunately S3 triggers ; if they did, we could have gotten away with a single trigger!) So let’s first define a trigger for JPG files by selecting “object created” as the event and entering “.png” as the suffix, and drag, drop and configure another trigger with “.jpg” as the suffix — for, you guessed it, JPG files. do not yet support patterns for file name prefixes/suffixes S3 trigger for PNG files There’s a small thing to remember when you select the bucket for the second trigger: even if you entered a new bucket name for the first trigger, you would have to select the same, already-defined bucket from the “Existing Bucket” tab for the second trigger, rather than providing the bucket name again as a “new” bucket. The reason is that Sigma keeps track of each newly-defined resource (since it has to create the bucket at deployment time) and, if you define a new bucket twice, Sigma would get “confused” and the deployment may not go as planned. To mitigate the ambiguity, we mark newly defined buckets as “(New)” when we display them under the existing buckets list (such as for a newly added ) - at least for now, until we find a better alternative; if you have a cool idea, feel free to . my-new-bucket (New) my-new-bucket chip in! Selecting our new S3 bucket, from the existing buckets list Now both triggers are ready, and we can move on to . operations S3 trigger list pop-up with both triggers configured You may have already noticed two S3 icons on the editor’s left pane, somewhat below the trigger indicator, right against the and calls. The parameter blocks of the two operations would also be highlighted. This indicates that Sigma has identified the API calls and can help you by automatically generating the necessary bells and whistles to get them working (such as execution permissions). s3.getObject s3.putObject A S3 operation, highlighted Click on the first icon (against ) to open the operation edit pop-up. All we have to do here is to select the correct bucket name for the parameter (again, ensure that you select the "(New)"-prefixed bucket on the "existing" tab, rather than re-entering the bucket name on the "new" tab) and click . s3.getObject Bucket Update S3 getObject operation pop-up Similarly, with the second icon ( ), select a destination bucket. Because we haven't yet added or played around with a destination bucket definition, here you will be adding a fresh bucket definition to Sigma; hence you can either select an existing bucket or name a new bucket, just like in the case of the first trigger. s3.putObject S3 putObject operation pop-up Just one more step: adding the dependencies. While Sigma offers you the cool feature of the ability to add third-party dependencies to your project, it does need to know the name and version of the dependency at build time. Since we copied and pasted an alien block of code into the editor, we should separately tell Sigma about the dependencies that are being used in the code, so that it can bundle them along with our project sources. Just click the “Add Dependency” button on the toolbar, search for the dependency and click “Add”, and all the added dependencies (along with two defaults, and ) will appear on the dependencies drop-down under the button. aws-sdk @slappforge/slappforge-sdk Add Dependency “Add Dependency” button with dependencies drop-down In our case, keeping with the , we have to add the (for waterfall-style execution flow) and (for ) dependencies. original AWS sample guidelines [async](https://www.npmjs.com/package/async) [gm](https://www.npmjs.com/package/gm) GraphicsMagick Adding async dependency Done! Now all that remains is to click the button on the IDE toolbar, to set the wheels in motion! Deploy Firstly, Sigma will save (commit) the app source to your GitHub repo. So be sure to provide a nice commit message when Sigma asks you for one :) You can pick your favourite repo name too, and Sigma will create it if it does not exist. (However, Sigma has a known glitch when an “empty” repo (i.e. one that does not have a master branch) is encountered, so if you have a brand new repo, make sure that you have at least one commit on the master branch; the easiest way is to create a Readme, which can be at repo creation.) easily done with one click Committing your code Once saving is complete, Sigma will automatically build your project, and open up a deployment summary pop-up showing everything that it would deploy to your AWS account with regard to your brand new S3 thumbnail generator. Some of the names will look gibberish, but they will generally reflect the type and name of the deployed resource (e.g. may represent a new S3 bucket named ). s3MyAwesomeBucket my-awesome-bucket Build in progress! Deployment changes summary Review the list (if you dare) and click . The deployment mechanism will kick in, displaying a live progress bar (and a log view showing the changes taking place in the underlying of your project). Execute CloudFormation stack Deployment in progress! Once the deployment is complete, your long-awaited thumbnail generator lambda is ready for testing! Just upload a JPG or PNG file to the source bucket you chose (via the , or via an if you are more like me), and marvel at the thumbnail that would pop up in your destination bucket within a matter of seconds! S3 console [aws s3 cp](https://docs.aws.amazon.com/cli/latest/reference/s3/cp.html) If you don’t see anything interesting in the destination bucket (after a small wait), you would be able to check what went wrong, by checking the lambda’s just like in the case of any other lambda; we know it’s painful to go back to the AWS consoles to do this, and we hope to find a cooler alternative to that as well, pretty soon. execution logs If you want to make the generated thumbnail public (as I said in my previous article, what good is a private thumbnail?), you don’t have to run around reading IAM docs, updating IAM roles and pulling your hair off; simply click the S3 operation edit icon against the call, select the parameter as from the drop-down, and click to go through another save-build-deploy cycle. (We are already working on speeding up these "small change" deployments, so bear with us for now :) ) s3.putObject ACL to apply to the object public-read Deploy Making thumbnails public: S3 putObject operation edit pop-up Once the new deployment is complete, in order to view any newly generated thumbnails, you can simply enter the URL into your favourite web browser and press Enter! http://<bucketname>.s3.amazonaws.com/resized-<original image name> Oh, and if you run into anything unusual — a commit/build/deployment failure, an unusual error or a bug with Sigma itself — don’t forget to — or post an issue on our ; you can do it right within the IDE, using the “Help” → “Report an Issue” menu item. Same goes for any improvements or cool features that you would like to see in Sigma in the future: faster builds and deployments, ability to download the build/deployment artifacts, a shiny new set of themes, whatever. Just let us know, and we’ll add it to our backlog and give it a try in the not-too-distant future! ping us via Slack public issue tracker Okay folks, time to go back and , while I write my next blog post! start playing with Sigma Stay tuned for more from SLAppForge! Originally published at randomizd.blogspot.com on March 9, 2018.