I have been experimenting with since Werner Vogels announced it a few weeks ago at AWS re:Invent 2017 ( ). AWS Cloud9 keynote video here This article is the paraphrased version of my talk , given at the on Jan 10th. AWS Cloud9 & CodeStar for Serverless Apps AWS User Group in Milan I am going to skip the “ ” section of my deck.If you are not familiar with Serverless, please have a look , or , or , or , or , or , or . Serverless Disclaimer here here here here here here here If you are familiar with Serverless and you don’t like it, you may still enjoy this article and the benefits of Cloud9 and CodeStar. Just make sure you mentally replace “ ” with “ ”, and “ ” with “ ” :) FaaS Container SAM CloudFormation What is AWS Cloud9? AWS Cloud 9 is a “ ” for writing, running, and debugging code. cloud IDE I’d start saying that most IDEs are fantastic tools to boost your productivity and the quality of your code if you can use them and invested a few months/years in learning them properly. That being said, some IDEs offer more advanced and useful features than others ( ). please don’t take it personally, unless you code in Word or Notepad in July 2016, which has now been rebranded as AWS Cloud9. Even though it looked brilliant on Werner’s browser, my first impression during the keynote was something along the lines of “ ”, immediately followed by “ ”. Like most software engineers, I’ve used many IDEs in the last ten years, for free, and I’m used to coding a lot while I’m traveling. AWS acquired Cloud9 Why should I pay to write code? Does that mean I cannot code when I’m offline? Apparently, I was not alone, and many developers asked the same questions during my presentation. So let me briefly recap my arguments. Regarding the cost, I believe it’s pretty much negligible for most organizations that already use AWS heavily (less than for a environment, 8 hours a day, 20 days a month). And without considering AWS Free Tier and automatic cost-saving settings (hibernation after 30min). $2 per month t2.micro The “ ” drawback is much harder to defend, but let me try. no coding offline Unless you are going for a hardcore debugging session over a well-established project, can you really code for more than 30min when you are offline? Can you or anything useful? Can you or the modules you need? Can you mock or ignore all the third-party services and APIs your application consumes? Can you avoid googling around your favorite framework’s documentation? git clone git pull npm install pip install Sure, you could prepare for a 12h flight and download/install everything you need in advance. But how often does that happen? Simply put, I’ve seen the best developers and engineers give up and take a break when the network goes down. On the other hand, AWS Cloud9 offers you a better alternative for when your machine gives up :) I could throw my dev machine out of the window right now, switch to my colleague’s notebook, login into my AWS Account and keep working on the very same Cloud9 session (which is saved and stored server-side). That means you could as well use a much cheaper machine such as a Chromebook or a tablet (or a phone?). Well, you could be 100% operational using the random machine of an internet cafe, or your grandmother’s computer :) Of course, there are always exceptions, and I’ll make sure I’m ready to use my local IDE when Cloud9 is not an option. In the meantime, I hope AWS will work on some sort of client-side offline support (and maybe turn Cloud9 into a progressive web app?). … and why does it matter for developers? I think AWS Cloud9 solves a bunch of problems for the many organizations currently trying to set up elaborate stacks of tools on every developer’s machine, especially if the team is heterogeneous and/or distributed. Let’s recap some of its features: It’s a (based on the ) full-fledged IDE Ace open-source editor It comes with an .It is a real ssh session directly your browser, without the need of managing and storing ssh keys or IAM credentials on your local machine. integrated web terminal This web terminal can run on a new EC2 instance managed by AWS Cloud9 (EC2 env.), or you can bring your own instance (SSH env.) EC2 environments offer quite a handy , which means you can optionally configure them to after 30 minutes of inactivity (or more) cost-saving functionality hibernate EC2 environments are based on , which includes .For example, the , etc.In case anything is missing, you can always install it :) this Amazon Machine Image at least 90% of the dev tooling you need AWS CLI, sam-local, git, gcc, c++, Docker, node.js, npm, nvm, CoffeeScript, Python, virtualenv, pip, pylint, boto3, PHP, MySQL, Apache, Ruby, Rails, Go, Java AWS Cloud9 comes with the you’d expect from a modern IDE (currently only for Node.js, though) live debugging capabilities It enables .You can share a Cloud9 environment with other and invite them with or permissions. collaborative coding and debugging sessions IAM users read-only read-write It comes with built-in support for .This greatly simplifies the process of creating new Lambda Functions, updating and testing their code locally, deploying new versions, etc. AWS Lambda Plus, is part of the team too. — or Serverless Application Model — is an open specification that allows you to define serverless applications and related resources with a simplified CloudFormation syntax. Cloud9 natively integrates some of the functionalities offered by , an open-source CLI tool written in Go by AWS to simplify local development and testing of Serverless applications. For example, you can invoke Functions locally and emulate API Gateway endpoints too. AWS SAM AWS SAM SAM Local I took the following screenshot during a live-debugging session of a very simple Lambda Function ( : I also spent 3 minutes customising theme & layout, according to my taste and needs). note AWS Cloud9 in action during a live-debugging session with Node.js AWS Cloud9 Limitations and my personal “wishes” I do have a few wishes for AWS Cloud9, and I’ve shared a few of them on Twitter (tweets below). Let me discuss a few of them: The “ ” are pretty reasonable, in my opinion. You can create up to 20 environments per user (max 10 open concurrently), 100 per account, and you can invite up to 8 members in each environment.These are reasonable numbers since (yet?) numeric limitations you can’t share environment across AWS accounts is terrific, but . I’m looking forward to built-in support for Python (and all the others, of course). Live debugging only available for Node.js The same holds for some currently not supported. For example, I couldn’t find a way to change the behavior for Python (only arguments are supported). Without custom linting, Python3 developers cannot benefit from ( is required). runtime customizations default linting and code completion pylint Python’s type hints capabilities mypy As discussed above, there is .Working offline may become a critical need in some scenarios/teams, although you can always download the whole environment to your local machine with one click ( ) and keep working locally. no support for “offline” development File > Download Project I think Cloud9 could be much , especially with services such as Lambda and API Gateway. For example, there is no easy way to jump to the Lambda Console of a given Function (or API Gateway). better integrated with the AWS Console The is excellent, but it’s still . For example, you can test a Function locally, but you can’t quickly pick the test event from a list of templates. For now, you can workaround this by running in the terminal. built-in Lambda integration not as productive as the native Lambda Console sam local generate-event What is AWS CodeStar? AWS CodeStar (aka ) is a sort of “ ” for the ever-expanding suite of tools for developers.It is a free service that lets you manage and link together services such as , , , , , , , , , etc. Code-* catch-all service CodeCommit CodeBuild CodePipeline CodeDeploy Lambda EC2 Elastic Beanstalk CloudFormation Cloud9 One of my 2018 new year resolutions is to use more memes in my decks (until someone decides to stop me, for some reason), so here’s how I presented some of the pain points that CodeStar can solve. Too many projects tend to and their , just because it sounds hard. But it doesn’t have to be that hard, right? postpone CI/CD until it’s way too late productivity level is too low Nobody likes . But they are vital from day one, for a manager to assess the status of a project, as well as for a developer to monitor how the system is behaving. building and maintaining real-time dashboards This is what most developers want to do all day. . How can you provide such a simple and frictionless experience without impacting quality and ownership? Just write some code and push to master Issue tracking can be a very , especially if not well integrated with source control, access control, team management, monitoring, etc. frustrating experience : I can statistically confirm that the JIRA meme generated 42% more laughs than all others combined. Data-driven parenthesis … and why does it matter for organizations? CodeStar may not be the best fit for every project/organization, especially the most experienced and advanced ones, but it definitely provides some very good defaults to get started with. It’s worth noting that CodeStar is 100% free, and you only pay for the resources it will spin up on your behalf. Let’s recap its features: CodeStar offers the concept of “ ”.Each template represents a complete stack and includes a sample app, with a given backend, programming language, and framework. project templates It supports three compute layers: , , and . EC2 Elastic Beanstalk Lambda It supports six programming languages: , , , , , and (plus plain HTML apps). C# Java Node.js Python PHP Ruby It supports plenty of frameworks: , , , , , , etc. : AWS Lambda projects only support Express (Node.js) and Spring (Java), plus a few sample projects for . Express Spring Django Flask ASP.NET Core Laravel Note Alexa Skills Depending on the project template of your choice, CodeStar will spin up a by linking together CodePipeline, CodeBuild, and CodeDeploy. CI/CD pipeline Every CodeStar project starts with ( ), either on . CodeStar will create the git repository for you (via OAuth in case of GitHub) and take care of triggers/hooks for CI/CD. source control git AWS CodeCommit or GitHub You can optionally to work with CodeStar. Currently, only Cloud9, Eclipse, and VSCode are natively supported (plus the regular AWS CLI). You’ll read more on the Cloud9 integration later in this article. configure your own coding tools Even though many projects start as a one-person effort over the weekend, good projects tend to evolve and . CodeStar allows you to invite IAM users to your project with one of these roles: (“God Mode”), (everything but team management), or (read-only dashboard access). More technical info . onboard more people quickly Owner Contributor Viewer here As mentioned above, is probably the most frustrating part of many projects, as it brings context switching, visibility, and misunderstanding issues into the equation. CodeStar allows you to into your project dashboard, which might help in reducing the context switch and centralizing all the information. issue tracking integrate JIRA or GitHub Issues CodeStar provides a (screenshot below), which includes a , a section, your project’s git history, API endpoints, open issues, Cloud9 environments, etc.You can as you wish and use this dashboard to check the overall status of your project quickly and effectively. customisable app dashboard project wiki section CloudWatch Metrics drag-and-drop sections around A typical CI/CD pipeline managed by CodeStar (AWS Lambda project) A brand-new CodeStar dashboard (AWS Lambda project) CodeStar’s team management and user roles AWS CodeStar Limitations and a few “ ” gotchas CodeStar can look like magic if you’ve never played with CodePipeline and CodeBuild, but unfortunately it’s not perfect yet. I’ve shared a few “wishes” on Twitter too (tweets below), and here’s a quick recap of what I’ve found. You can create up to (it looks like the number came out of some kind of thoughtful calculation, right?), but you can only have and .As for Cloud9, these seem like reasonable numbers, especially since CodeStar or temporary access credentials, which means you’ll need to create a lot of users if a few developers start collaborating across AWS Accounts. 333 projects per account 10 projects per user 100 users per project does not support federated users Although the default user roles seem to cover most use cases, you are stuck with the owner/contributor/viewer permissions as . For example, you may want to have a “ ” role with view-only and team-management permissions. you can’t create custom roles project manager Remember that . If you want other owners or contributors to join your Cloud9 environment, you’ll have to invite them explicitly. Which makes sense, but I believe it could be improved/automated. CodeStar permissions are not related to Cloud9 permissions The most critical limitation I’ve found is that . As I’ve mentioned already, CodeStar provides pretty good defaults for a lot of things, but you’ll probably need to change a few details here and there. For example, you may want to add a testing step to CodePipeline, add custom permissions to the default IAM role, edit the default build file, change the default API Gateway stage, etc. And once you’ve done that, so that your team will start from there. Which means you’ll have to apply your customizations to each new project. And you only have two options: 1) , or 2) (please note that every project will create one or more CloudFormation Stack and that the original templates are not versioned anywhere, so good luck with that!). Plus, see the next bullet point :) there is no way to customise project templates there is no way to save your edits into a new custom project template applying changes manually automatically applying Change Sets to your CloudFormation Stacks Some of the CodeStar functionalities are based on such as the resource and the transform. They both sound pretty powerful, but there is no easy way to know what they are used for (or how we could use them).My current understanding is that will wait for all the other resources to be deployed (i.e. ) and then make sure everything is okay (e.g. IAM permissions, project id, etc.). seems to simply to inject into the processed template so that we don’t have to. mysterious and undocumented CloudFormation magic AWS::CodeStar::SyncResources AWS::CodeStar AWS::CodeStar::SyncResources DependsOn AWS::CodeStar SyncResources What about AWS CodeStar + AWS Cloud9? Cloud9 and CodeStar are pretty cool services on their own, and I was excited to see how they’ve been integrated. Or, better, how Cloud9 has been integrated into CodeStar. You can associate AWS Cloud9 Environments to your CodeStar project natively. In case multiple developers are working on the same project, you can create and assign a Cloud9 Environment to each developer (eventually, they’ll collaborate and invite each other, if needed). Once you open Cloud9, you’ll find your IAM credentials integrated with git ( ) and your CodeCommit repository already cloned for you. which does require some work Unfortunately, this (for now?). magic doesn’t happen if you choose GitHub As a couple of friends and colleagues pointed out, it’s not such a critical or technical complex integration, in the sense that you could have taken care of it yourself (as you’d do on your local machine). But I think it’s a great way to and , especially when you work on and . streamline the development experience reduce the margin for error multiple projects multiple accounts For example, most developers make great use of when working on their local machine, and some of them also manage to remember which profile can do what, in which account, etc. With CodeStar+Cloud9 since every Cloud9 environment is bound to a specific project and account. Also, since CI/CD is enabled by default, most of the time you will just and 💛 AWS profiles you won’t care anymore about profiles or local credentials write code, test with sam-local git push Of course, you may also have a generic Cloud9 Environment (i.e. not related to a specific project) and use it with multiple profiles to manage unique resources or prototype new stuff. Let me open a parenthesis: AWS SAM I decided to conclude my presentation with a brief parenthesis about AWS SAM, which got a few mentions and therefore deserves some context. ** Serverless alert ** Meet SAM! stands for , and it’s an whose goal is to offer a standard way to define serverless applications. SAM Serverless Application Model open specification Technically speaking, it’s a named that will convert special Serverless resources such as into standard CloudFormation syntax. CloudFormation Transform AWS::Serverless AWS::Serverless::Function You can think of Transforms as a way to so that you can define complex resources and their relationships in a much more concise way. augment the expressiveness of CloudFormation templates If you are familiar with other tools such as the Serverless Framework, you’ll notice that the syntax is quite similar (there is even a ). plugin to convert your templates to SAM In fact, you can deploy SAM templates with , a CLI tool for local development written in Go and officially released by AWS. AWS SAM Local You can use AWS SAM Local to and too. The CLI tool is available by default on every Cloud9 EC2 Environment, and the UI already supports some of its functionalities. test your Lambda Functions locally emulate API Gateway endpoints A few SAM examples A simple serverless Function (additional properties are available for IAM policies, VCP config, DLQ, tracing, etc.) The same Function defined above, plus CodeDeploy Traffic Shifting (10% every 10min) The same Function defined above, plus an API Gateway endpoint (nothing else needs to be defined) A simplified DynamoDB definition (only primary key and throughput) An API Gateway defined in swagger format (sam-local will package it to S3 before deploying!) My personal “wishes” for AWS SAM I have only one wish for AWS SAM: I would love to see more transparency and documentation related to the Transform. AWS::Serverless AWS SAM is now ! Apr 2018 Update: open-source on GitHub And since I like dreaming, why not allowing ? I am almost ready to bet they are implemented with some kind of Lambda hook, and I can’t even start to imagine how many great things the community might be able to develop and share that way. custom CloudFormation Transforms too I hope you learned something new about AWS Cloud9 and CodeStar (please don’t confuse them and create weird hybrids such as “ ” as I did a few times). I would recommend building a simple prototype or a sample project on CodeStar asap. You can get started ! CloudStar here If you got this far, you probably enjoyed the article or feel like sharing your thoughts. Either way, don’t forget to recommend & share, and please do not hesitate to give feedback & share your ideas =)
Share Your Thoughts