Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic creation of EBS snapshots #2

Open
hadley31 opened this issue Jul 26, 2024 · 0 comments
Open

Automatic creation of EBS snapshots #2

hadley31 opened this issue Jul 26, 2024 · 0 comments
Assignees

Comments

@hadley31
Copy link
Collaborator

Summary

Each time the Counter-Strike 2 Server AWS task is started, an EBS volume mounted to ~/cs2-dedicated gets created to store the game installation. This way, the game gets persisted if the AWS task is brought down, and we do not need to download the 40+ GB game over and over each time a task is spun up. However, due to the nature of ECS, when the task is stopped, the EBS volume will always be deleted - and there is no way around this.

So how do we prevent downloading the game over and over? Snapshots. Elastic Container Service allows you to configure the EBS volume to be created using a snapshot. A snapshot is simply a static copy of a volume, that you can create new volumes from, like a starting point. This means we can create a snapshot with the Counter-Strike 2 install, and use that snapshot to create the volumes for our server tasks.

There is still one drawback of this approach - updates. Every time Counter-Strike 2 updates, our task will need to download the latest changes and install them, leaving the volume different from the outdated snapshot. This means that when the game updates, we will need to create a new snapshot with the up-to-date version of the game, and delete the old snapshot.

Proposed Solutions

Solution 1 (Preferred)

In the pre hook script, somehow detect that the game was updated. There may be a file which lists the version of the game. Then run an aws cli command to create the snapshot. Note: the service will need to be updated to use the new snapshot.

Solution 2

Create a lambda on a cloudwatch timer to periodically create a new snapshot. This solution is more naive, and possibly more expensive, but would likely fit our needs since the game doesn't update very often.

Solution 3

Stop using EBS. The two options for configuring volumes for ECS tasks are Elastic Block Store (EBS) and Elastic File System (EFS). Elastic File System is a much more expensive solution. Elastic Block Store was chosen due to being the cheaper option. There are some advantages to using EFS over EBS, but there are some also some disadvantages too, besides cost. Using EFS would allows you to share a single volume across multiple tasks, and it is not destroyed when a task is stopped. This would allow us to manage our server from an EC2 instance, while it is also attached to the server task in ECS. But that would slightly defeat the purpose of having the configuration version controlled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants