What if deploying your app felt like dropping a file into a folder?

That was my goal for this project. I built a small pipeline on AWS where I upload a .zip to an S3 bucket, and a few seconds later the new version of my game is live on an EC2 server. No SSH session. No Jenkins. No clicking "Deploy".

The app is Neon Snake, a tiny HTML/JS snake game. The interesting part isn't the game, it's the plumbing around it.

The architecture

The flow:

  1. I upload neon-snake-game.zip to an S3 bucket.
  2. S3 fires an "object created" event.
  3. That event triggers a Lambda function (I called it SnakeDeployer).
  4. Lambda calls AWS Systems Manager (SSM) Run Command and sends a shell script to my server.
  5. The SSM Agent on the EC2 instance runs the script: download the zip from S3, unpack it into the nginx web root, restart nginx.
  6. CloudWatch and the Run Command history keep a record of every deployment.

Here's the same idea as a quick sketch:

Why SSM instead of SSH?

This is the part I liked most. The EC2 instance has no SSH port open. Its security group allows one inbound door: port 80 for people visiting the game.

So how does Lambda tell the server what to do? It doesn't connect to the server at all. The SSM Agent running on the instance makes outbound HTTPS (443) calls to Systems Manager and picks up jobs. It's a pull model, not a push model.

That means:

  • No SSH keys to manage or leak
  • No port 22 to defend
  • Every command is logged in Run Command history

Step 1: The artifact bucket

I created a general-purpose S3 bucket in us-east-1 called neon-snake-artifacts-<account-id>-us-east-1-an. This is where every build lands. Uploading here is the deploy action.

Step 2: One small server

The server is a single t3.micro running Amazon Linux in us-east-1c, with nginx installed and enabled. After launch it showed Running with 3/3 status checks passed.

Two things the instance needs:

  • An IAM instance profile with the AmazonSSMManagedInstanceCore managed policy, so the SSM Agent can register with Systems Manager
  • Read access to the artifact bucket (s3:GetObject), so the deploy script can download the zip

A minimal inline policy for the bucket looks like this (swap in your bucket name):

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": ["s3:GetObject"], "Resource": "arn:aws:s3:::YOUR-BUCKET-NAME/*" } ] } 

And the security group: inbound HTTP 80 only. No port 22.

Step 3: The trigger

On the bucket, under Properties → Event notifications, I created one notification:

  • Event types: All object create events
  • Destination: Lambda function SnakeDeployer

That single entry wires the whole pipeline together.

Step 4: The deploy bot (Lambda)

The Lambda function reads the bucket and key from the S3 event, then asks SSM to run a shell script on the instance. Here's a version of that logic in Python (adjust names and IDs to your setup):

import json import urllib.parse import boto3 ssm = boto3.client("ssm") INSTANCE_ID = "i-xxxxxxxxxxxxxxxxx" # your EC2 instance WEB_ROOT = "/usr/share/nginx/html" def lambda_handler(event, context): record = event["Records"][0]["s3"] bucket = record["bucket"]["name"] key = urllib.parse.unquote_plus(record["object"]["key"]) commands = [ "set -e", f"aws s3 cp s3://{bucket}/{key} /tmp/game.zip", f"sudo rm -rf {WEB_ROOT}/*", f"sudo unzip -o /tmp/game.zip -d {WEB_ROOT}", "sudo systemctl restart nginx", ] response = ssm.send_command( InstanceIds=[INSTANCE_ID], DocumentName="AWS-RunShellScript", Parameters={"commands": commands}, Comment=f"Deploy {key}", ) command_id = response["Command"]["CommandId"] print(f"Sent command {command_id} for s3://{bucket}/{key}") return {"statusCode": 200, "body": json.dumps({"commandId": command_id})} 

The Lambda execution role needs permission to call ssm:SendCommand on the AWS-RunShellScript document and on your instance, plus the usual CloudWatch Logs permissions (AWSLambdaBasicExecutionRole):

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "ssm:SendCommand", "Resource": [ "arn:aws:ssm:us-east-1::document/AWS-RunShellScript", "arn:aws:ec2:us-east-1:YOUR-ACCOUNT-ID:instance/i-xxxxxxxxxxxxxxxxx" ] } ] } 

Step 5: Ship it

Time for the real test. I uploaded the zip to the bucket:

A few seconds later, Systems Manager → Run Command → Command history showed a new entry with status Success, using the AWS-RunShellScript document:

Proof on the server

I also checked the box itself with sudo systemctl status nginx:

nginx was active (running), and its start time was 20:37:50 UTC. The Run Command request in history was stamped 20:37:48 GMT. That's two seconds from command to restart, with me never opening a terminal on the box to deploy.

Shipping again

A deployment pipeline is only useful if it's repeatable. I uploaded another build, and another Success appeared in Command history. Every deploy leaves an audit trail for free.

The result

Neon Snake, served by nginx on EC2:

(I scored 70 before crashing into myself. The pipeline worked on the first try. The snake did not.)

What I learned

  • Events beat clicks. One S3 event notification replaced an entire manual process.
  • SSM Run Command can replace SSH for a lot of day-to-day server tasks, with no keys and no open port 22.
  • IAM is the glue. The Lambda function and the instance each get only the permissions they need.
  • Logging comes free. Command history is a ready-made deployment log.

What I'd improve next

  • Put CloudFront + HTTPS in front of the server
  • Define everything as Infrastructure as Code (CloudFormation, CDK, or Terraform)
  • Use versioned artifacts and a rollback path instead of overwriting the web root
  • Compare this setup with AWS CodeDeploy / CodePipeline for larger apps

Wrapping up

This was a small project, but it taught me how several core AWS services fit together: S3 events, Lambda, Systems Manager, EC2, and IAM. If you're learning AWS, I'd recommend building something like this. It makes the "serverless glue" idea click.

If you have questions or ideas for improving the pipeline, drop a comment. And if you build your own version, I'd love to see it.

You can find me on LinkedIn and GitHub.