Modern software development requires reliable, scalable, and automated deployment processes. Manual deployment can be time-consuming, error-prone, and difficult to maintain. This project, titled Neon Snake: Serverless CI/CD Pipeline, demonstrates how AWS services can work together to automate application deployment.

The solution uses Amazon S3, AWS Lambda, AWS Systems Manager (SSM), Amazon EC2, and Nginx to deploy a web-based Snake game automatically whenever a new application package is uploaded to an S3 bucket.

The primary objective is to eliminate manual server access during deployment while providing a simple, event-driven deployment architecture.

Keywords: AWS, Serverless Computing, CI/CD, Amazon S3, AWS Lambda, Systems Manager, EC2, Nginx, Automation.

1. Introduction

Continuous Integration and Continuous Deployment (CI/CD) are important practices in modern software engineering. They help development teams deliver application updates more efficiently and consistently.

Traditional deployment processes often require developers to connect to servers, manually transfer application files, extract packages, and restart web services.

The Neon Snake project addresses these challenges by implementing an automated deployment workflow using AWS cloud services.

Instead of manually accessing the EC2 server, developers simply upload a ZIP package containing the application files to Amazon S3. This upload automatically triggers a Lambda function, which communicates with the target EC2 instance through AWS Systems Manager.

The EC2 instance then downloads the application package, extracts the files into the Nginx web directory, and restarts the web server.

2. Project Objectives

The main objectives of this project are:

  • Automate application deployment using AWS services.
  • Implement an event-driven architecture using Amazon S3 and Lambda.
  • Use AWS Systems Manager to execute commands remotely on EC2.
  • Deploy a web application using Nginx.
  • Implement IAM roles for secure service communication.
  • Reduce manual server administration.
  • Demonstrate a practical cloud-based CI/CD workflow.

3. Technologies and AWS Services Used

3.1 Amazon S3

Amazon Simple Storage Service (S3) is used as the artifact storage location.

The project creates a bucket named neon-snake-artifacts-<unique> in the US East (N. Virginia) region.

Developers upload the application package, game.zip, to this bucket. The creation of a new object generates an event that triggers the deployment process.

3.2 AWS Lambda

AWS Lambda acts as the deployment automation engine.

The project uses a Lambda function named SnakeDeployer, written in Python.

Its responsibilities include:

  • Receiving S3 event notifications.
  • Identifying the uploaded bucket and object key.
  • Creating deployment commands.
  • Sending commands to the target EC2 instance through Systems Manager.

This approach eliminates the need for a continuously running deployment server.

3.3 AWS Systems Manager (SSM)

AWS Systems Manager provides secure remote command execution.

The Lambda function uses the SSM SendCommand API with the AWS-RunShellScript document.

The SSM Agent installed on the EC2 instance communicates with Systems Manager through outbound HTTPS connections, receives the deployment instructions, and executes them.

3.4 Amazon EC2

Amazon EC2 provides the computing environment that hosts the Neon Snake game.

The project uses:

  • Instance name: NeonSnakeServer
  • Operating system: Amazon Linux 2023
  • Instance type: t3.micro
  • Web server: Nginx
  • HTTP access: Enabled

The EC2 instance is configured with an IAM instance profile so that it can communicate with Systems Manager and download application files from S3.

3.5 Nginx

Nginx is used as the web server.

The extracted game files are placed in:

/usr/share/nginx/html

Nginx serves these files to users through HTTP.

3.6 AWS IAM

Identity and Access Management (IAM) provides the permissions required for secure communication between AWS services.

Two IAM roles are created:

EC2 Role: iam_role_snake_server

  • AmazonSSMManagedInstanceCore
  • AmazonS3ReadOnlyAccess

Lambda Role: iam_role_snake_deployer

  • AmazonSSMFullAccess
  • AmazonS3ReadOnlyAccess
  • AWSLambdaBasicExecutionRole

These roles provide the permissions required by the deployment workflow.

3.7 Amazon CloudWatch

Amazon CloudWatch receives Lambda execution logs. These logs help developers investigate execution problems and troubleshoot deployment failures.

4. System Architecture and Working Methodology

The system follows an event-driven deployment architecture.

The deployment process consists of the following stages:

Stage 1: Application Upload

The developer uploads game.zip to the Amazon S3 artifact bucket.

Stage 2: S3 Event Notification

Amazon S3 detects the newly created object and invokes the configured Lambda function.

Stage 3: Lambda Execution

The SnakeDeployer function processes the event, extracts the bucket name and object key, and prepares the deployment commands.

Stage 4: Remote Command Execution

Lambda sends the commands to AWS Systems Manager using the AWS-RunShellScript document.

The SSM Agent running on the EC2 instance receives the deployment instructions.

Stage 5: Application Deployment

The EC2 instance performs the following operations:

  1. Downloads the uploaded ZIP file from S3.
  2. Removes the existing web application files.
  3. Creates a temporary deployment directory.
  4. Extracts the ZIP package.
  5. Moves the extracted files into the Nginx web directory.
  6. Removes temporary deployment files.
  7. Restarts Nginx.

Stage 6: Application Access

After deployment, users can access the Neon Snake game through the public IPv4 address of the EC2 instance.

5. Implementation

The project is implemented through five major laboratory exercises.

Lab 1: Creating IAM Roles

Two IAM roles are created to establish secure communication between Lambda, S3, Systems Manager, and EC2.

The EC2 role allows the instance to register with Systems Manager and read application artifacts from S3.

The Lambda role allows the function to send deployment commands, access the required AWS resources, and generate execution logs.

Lab 2: Creating the S3 Artifact Bucket

An S3 bucket is created using the naming convention:

neon-snake-artifacts-<unique>

The bucket is created in the us-east-1 region.

This bucket stores the application ZIP package used during deployment.

Lab 3: Launching the EC2 Web Server

An EC2 instance named NeonSnakeServer is launched using Amazon Linux 2023 and the t3.micro instance type.

Nginx and unzip are installed through EC2 user data.

The Nginx service is started and enabled, and the web directory permissions are configured.

Lab 4: Creating the Lambda Deployment Function

A Lambda function named SnakeDeployer is created using Python.

The function uses the Boto3 library to communicate with AWS Systems Manager.

When an S3 upload event occurs, the function sends shell commands to the EC2 instance.

The deployment process is connected to S3 through an event trigger configured for all object creation events.

Lab 5: Testing the CI/CD Pipeline

The deployment pipeline is tested by uploading the application package using the AWS CLI:

aws s3 cp game.zip s3://neon-snake-artifacts-<UNIQUE>/

After uploading the file, the deployment is triggered automatically.

The deployment status is checked through:

AWS Console → Systems Manager → Run Command → Command history.

A successful AWS-RunShellScript execution indicates that the remote deployment commands completed successfully.

Finally, the public IPv4 address of the EC2 instance is opened in a browser to access the Neon Snake game.

6. Security Considerations

Security is an important part of the project architecture.

The system uses IAM roles instead of embedding AWS credentials directly into application code.

The EC2 instance communicates with Systems Manager through outbound HTTPS, avoiding the need for direct SSH access in the lab configuration.

The EC2 instance also receives read-only S3 access, while the Lambda function receives the permissions needed to manage the deployment workflow.

For production environments, permissions should be further restricted to the specific bucket and target EC2 instance. Public HTTP access should also be replaced or protected with HTTPS, and deployment commands should include validation and rollback mechanisms.

7. Advantages of the Proposed System

The Neon Snake deployment pipeline provides several benefits:

  1. Automation: Application deployment starts automatically after an S3 upload.
  2. Reduced Manual Work: Developers do not need to manually connect to EC2 and transfer files.
  3. Event-Driven Architecture: AWS services respond automatically to object creation events.
  4. Centralized Artifact Storage: Application packages are stored in Amazon S3.
  5. Remote Management: Systems Manager executes deployment commands without requiring SSH access.
  6. Monitoring: CloudWatch provides Lambda execution logs for troubleshooting.
  7. Scalability: The architecture demonstrates a foundation that can be extended to support additional applications and deployment environments.

8. Limitations and Future Improvements

Although the project successfully demonstrates automated deployment, several improvements could make the system more suitable for production.

  • Add application versioning and rollback functionality.
  • Introduce deployment validation before replacing existing files.
  • Configure HTTPS using a domain name and SSL/TLS certificate.
  • Restrict IAM permissions according to the principle of least privilege.
  • Add deployment notifications through Amazon SNS.
  • Implement health checks after deployment.
  • Introduce automated testing before publishing application packages.
  • Consider blue-green or rolling deployment strategies for applications requiring minimal downtime.

9. Conclusion

The Neon Snake project demonstrates how AWS cloud services can be integrated to create an automated, event-driven CI/CD deployment pipeline.

By combining Amazon S3, AWS Lambda, Systems Manager, EC2, Nginx, IAM, and CloudWatch, the project eliminates several manual steps traditionally involved in web application deployment.

The most important feature is that uploading a new application package to S3 automatically initiates the deployment process. Lambda coordinates the workflow, Systems Manager executes remote commands, and EC2 hosts the updated application.

This project provides practical experience with cloud computing, serverless automation, infrastructure management, IAM security, and CI/CD concepts.

Overall, the Neon Snake pipeline serves as an educational example of how AWS services can simplify application deployment and provide a foundation for more advanced cloud automation solutions.

10. References

  1. AWS Documentation – Amazon S3: https://docs.aws.amazon.com/s3/
  2. AWS Documentation – AWS Lambda: https://docs.aws.amazon.com/lambda/
  3. AWS Documentation – AWS Systems Manager: https://docs.aws.amazon.com/systems-manager/
  4. AWS Documentation – Amazon EC2: https://docs.aws.amazon.com/ec2/
  5. AWS Documentation – AWS IAM: https://docs.aws.amazon.com/iam/
  6. Nginx Documentation: https://nginx.org/en/docs/

Project Source: Neon Snake: Serverless CI/CD Pipeline – KodeKloud Lambda Lab Guide.