Here is what you should know about the AWS Application Composer Service
Tags: aws, applicationcomposer, serverless, nocode
Published: 2023-03-11 09:13:16

_Are you a developer tired of manually configuring AWS services to build your serverless applications? Say hello to AWS's newest offering, the Application Composer Service. This innovative tool allows developers to visually compose serverless applications using AWS services, generating infrastructure as code (IaC) that follows best practices. The service also promotes team collaboration by simplifying the sharing and building of architecture models. Plus, its user-friendly interface makes it easy to add AWS services to your application with just a few clicks. With the Application Composer Service, you can focus on building your application, not configuring infrastructure._

### Let's Decode the Application Composer Service Via 5Ws and 1Hs.


#### What is an Application Composer Service?

> A recent addition by AWS to its service offerings is to provide a No Code Solution to AWS Engineers (Primarily Focusing on Serverless Applications). This is a tool that enables users to create custom applications by composing pre-built components or building new components from scratch.


#### Who can use Application Composer Service?

> It is mostly used by AWS Engineers or Developers who are building the Solution on AWS Cloud (And want to have a blueprint defined for the Serverless Application to Start with) which can be customised later on based on their requirements.

#### When can Application Composer Service be used?

> Application Composer Service can be used when there is a need to create custom applications that are tailored to specific business needs. This may include creating new applications from scratch, modifying existing ones, or integrating multiple ones into a single platform.

#### Where can Application Composer Service be used?

> It can be used from the AWS Service offerings, as AWS has released it as a service. You can make use of your Local Storage device to store the templates and state of your code.

#### Why use Application Composer Service?

> There are several reasons to use Application Composer Service. First, it allows users to create custom applications without the need for extensive programming knowledge, which can save time and resources. Second, it provides pre-built components that can be easily combined to create new applications, reducing the need for custom coding. 

#### How does Application Composer Service work?

> Application Composer Service works by providing users with a set of pre-built components that can be combined to create custom applications. These components include AWS Services, templates, and custom input, which can be modified using a drag-and-drop interface. Users can also build new components from scratch using a visual development environment. Once the application is created, it can be deployed to the cloud and accessed by users from anywhere with an internet connection.


## Decoding the Components of Application Composer Service

Are you excited to try out AWS's new Application Compose Service? Once you've signed up for the service, you'll have access to the Application Compose Service console, where you can get started on your project. The console offers two options to get you started:

![Application Composer Service Console](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dayhcfsmi9yu3zm1a4u5.png)

**Open Demo** - This option allows you to explore a pre-existing demo project to help you get familiar with the service and its capabilities.

**Create Project** - This option enables you to start a new custom project from scratch, where you can select the AWS services you need and visually compose your serverless application.

> With these two options, you can easily get started with the Application Compose Service, whether you're new to the service or an experienced user looking to create a custom project.


**Once you select the Option CREATE PROJECT**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o0p1cok1ut0up6zv8ddv.png)

### You'll have two options to choose from:

**New Blank Project** - With this option, you can start building your application from scratch using the drag-and-drop feature. This is ideal if you're starting a new project and want to build your application step by step.

**Load Existing Project** - If you already have a pre-existing SAM template in place, this option allows you to load that template into the Application Compose Service and start making changes right away.

> In addition to these two options, you'll also need to decide how you want to store your work. The Application Compose Service offers two storage options:

**Connected** - With this option, your local workspace is connected to the cloud workspace, so any changes you make from your end will automatically sync at both places. This is ideal if you need to work on your application from multiple devices or locations.

**Unconnected** - If you choose this option, your work is saved in your AWS space only, and you won't be able to access it from other devices or locations. This is ideal if you're working on your application from a single device or location.

### Lab Setup

To get started, you'll need to select the "**New Blank Project**" option from the console and choose the AWS region you want to work in. Then, you can drag and drop the necessary AWS services onto the canvas.

First, we'll drag and drop the S3 service onto the canvas and create a new bucket. Next, we'll add the Lambda service to the canvas and create a new function. We'll set the event trigger to be "S3 Put Object" and specify the S3 bucket we created earlier as the event source.

Then, we'll add the SNS service to the canvas and create a new topic. We'll update the Lambda function's code to publish a message to the SNS topic whenever a new object is uploaded to S3.

Finally, we'll configure the SNS topic to consume the Lambda notification. We'll add a new subscription to the topic and choose the protocol as "Email" or "SMS" to receive notifications.

Once you've completed these steps, you can save your project and deploy it to your AWS account. With the Application Compose Service, building serverless applications has never been easier!

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ehhxbkf5js53wtx575hq.png)

Or you can make use of the Code that I've generated using the Console

```
AWSTemplateFormatVersion: "2010-09-09"
Description: This CloudFormation template deploys the Axcess Demo Project, consisting of an RDS database instance and a security group for Axcess.
Metadata:
  AxcessDemoProjectDescription: |
    The Axcess Demo Project is a sample project that showcases the deployment of an RDS database instance and a security group for Axcess. The project is intended to demonstrate the basic configuration of these AWS resources in a CloudFormation stack.
  AWS::Composer::Groups:
    Group:
      Label: Custom RDS Resource
      Members:
        - DBInstance
Resources:
  DBInstance:
    Type: AWS::RDS::DBInstance
    Properties:
      AllocatedStorage: "5"
      DBInstanceClass: db.t2.small
      DBName: axcessdummydb
      Engine: MySQL
      MasterUserPassword: axcessadmin
      MasterUsername: axcessadmin
    DeletionPolicy: Snapshot
  LambdaTriggerNotification:
    Type: AWS::SNS::Topic
    Properties:
      FifoTopic: true
      ContentBasedDeduplication: true
  S3BucketToUploadData:
    Type: AWS::S3::Bucket
    Properties:
      BucketName: !Sub ${AWS::StackName}-s3buckett-${AWS::AccountId}
      BucketEncryption:
        ServerSideEncryptionConfiguration:
          - ServerSideEncryptionByDefault:
              SSEAlgorithm: aws:kms
              KMSMasterKeyID: alias/aws/s3
      PublicAccessBlockConfiguration:
        IgnorePublicAcls: true
        RestrictPublicBuckets: true
  S3BucketToUploadDataBucketPolicy:
    Type: AWS::S3::BucketPolicy
    Properties:
      Bucket: !Ref S3BucketToUploadData
      PolicyDocument:
        Id: RequireEncryptionInTransit
        Version: "2012-10-17"
        Statement:
          - Principal: "*"
            Action: "*"
            Effect: Deny
            Resource:
              - !GetAtt S3BucketToUploadData.Arn
              - !Sub ${S3BucketToUploadData.Arn}/*
            Condition:
              Bool:
                aws:SecureTransport: "false"
  NotificationLambda:
    Type: AWS::Serverless::Function
    Properties:
      Description: !Sub
        - Stack ${AWS::StackName} Function ${ResourceName}
        - ResourceName: NotificationLambda
      InlineCode: |
        import boto3
        def handler(event, context):
            # Get S3 bucket and object details from the event
            s3_bucket = event['Records'][0]['s3']['bucket']['name']
            s3_key = event['Records'][0]['s3']['object']['key']
            # Create SNS client
            sns = boto3.client('sns')
            # Construct SNS message
            message = f"A new object was uploaded to S3 bucket {s3_bucket}: {s3_key}"
            # Publish SNS message
            response = sns.publish(
                TopicArn='arn:aws:sns:us-east-1:123456789012:MySNS', # Replace with your SNS topic ARN
                Message=message
            )
            # Log response from SNS
            print(response)
      Handler: index.handler
      Runtime: python3.9
      MemorySize: 256
      Timeout: 30
      Tracing: Active
      Events:
        S3BucketToUploadData:
          Type: S3
          Properties:
            Bucket: !Ref S3BucketToUploadData
            Events:
              - s3:ObjectCreated:*
              - s3:ObjectRemoved:*
      Environment:
        Variables:
          TOPIC_NAME: !GetAtt LambdaTriggerNotification.TopicName
          TOPIC_ARN: !Ref LambdaTriggerNotification
      Policies:
        - SNSPublishMessagePolicy:
            TopicName: !GetAtt LambdaTriggerNotification.TopicName
  NotificationLambdaLogGroup:
    Type: AWS::Logs::LogGroup
    DeletionPolicy: Retain
    Properties:
      LogGroupName: !Sub /aws/lambda/${NotificationLambda}
Transform: AWS::Serverless-2016-10-31
```
Deploy the above template from the CloudFormation Management Console:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f62dhvkr9s6u60p6k8lp.png)

### Advantages:

- 
**Drag-and-Drop Feature**: With the Application Compose Service, you don't need to write any code. Instead, you can simply drag and drop the necessary AWS services onto the canvas to create an industry-standard template that follows best practices. This not only speeds up development time, but also ensures that your application is built to a high standard.

- 
**Easy to Use and Visualize**: The Application Compose Service offers a user-friendly interface that makes it easy to create, modify, and visualize your application. You can easily see how all the different services and components fit together, and you can make changes on the fly as needed.

- 
**Custom Templates**: In addition to the pre-built templates available in the Application Compose Service, you can also create custom templates that are tailored to your specific needs. The Application Compose Service offers a read-only mode that lets you visualize your custom template before deploying it, so you can be sure it's exactly what you need.

### Limitations:

- **Still Need CloudFormation for Modification**: While the Application Compose Service makes it easy to create a serverless application, it is not a complete replacement for CloudFormation. If you need to modify your application beyond what the Application Compose Service can handle, you will still need to use CloudFormation directly.

- **Lambda Function Code Must Still Be Written**: While the Application Compose Service can provision the infrastructure for your Lambda functions, you will still need to write the code in the appropriate language to solve your problem. This means that the Application Compose Service may not be suitable for developers who are not comfortable writing code.

- **Code Must Still Be Copied and Pasted**: While the Application Compose Service makes it easy to create and modify templates, you will still need to copy and paste the resulting SAM and CloudFormation templates to a location or S3 bucket for deployment. You cannot deploy directly from the console.

- **Not Suitable for Complicated Use Cases**: While the Application Compose Service is great for simple use cases, it may not be the best choice for more complex applications. If your application requires a lot of customization or involves many different AWS services, you may find the Application Compose Service too limiting.

### Conclusion
In conclusion, the AWS Application Composer Service provides an easy-to-use drag-and-drop interface to visually compose serverless applications. It generates infrastructure as code templates that follow industry best practices, making it an excellent choice for developers who want to quickly create serverless applications. However, it has its limitations, such as the need for additional customization using CloudFormation, the requirement to write the code for Lambda functions, and the inability to deploy from the console directly. Overall, the Application Composer Service can be an excellent tool for creating simple serverless applications with ease.