在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):vatertime/minecraft-spot-pricing开源软件地址(OpenSource Url):https://github.com/vatertime/minecraft-spot-pricing开源编程语言(OpenSource Language):开源软件介绍(OpenSource Introduction):Complete Minecraft Server Deployment (CloudFormation)The template contained within this repository can be used to deploy a Minecraft server to Amazon Web Services (AWS) in minutes. As the solution leverages "Spot Pricing", the server should cost less than a cent an hour to run, and you can even turn it off when you and your friends aren't playing - saving even more money. Prerequisites
OverviewAll of this is shamelessly copied and tweaked from the Factorio Spot Pricing template. The solution builds upon the itzg/docker-minecraft-server Docker image, so generously curated by the contributors (thank you!). In a nutshell, the CloudFormation template launches an ephemeral instance which joins itself to an Elastic Container Service (ECS) Cluster. Within this ECS Cluster, an ECS Service is configured to run a Minecraft Docker image. The ephemeral instance does not store any saves, mods, Minecraft config, data etc. - all of this state is stored on a network file system (Elastic File System - EFS). The CloudFormation template is configured to launch this ephemeral instance using spot pricing. What is spot pricing you might ask? It's a way to save up to 90% on regular "on demand" pricing in AWS. There are drawbacks however. You're effectively participating in an auction to get a cheap instance. If demand increases and someone else puts in a higher bid than you, your instance will terminate in a matter of minutes. A few notes on the services we're using...
Getting Started
Next StepsAll things going well, your Minecraft server should be running in five minutes or so. Wait until CloudFormation reports the stack status as At this point you should really configure remote access as per the below section, so that you can access the server and modify Optional FeaturesRemote AccessIf you know what you're doing, you might want to SSH onto the Linux instance to see what's going on / debug / make improvements. For security, SSH should be locked down to a known IP address (i.e. you), preventing malicious users from trying to break in (or worse - succeeeding). You'll need to create a Key Pair in AWS, find your public IP address, and then provide both of the parameters in the Remote Access (SSH) Configuration (Optional) section. For remote access, you'll need to:
If you're creating a new Minecraft deployment, provide these parameters when creating the stack. Otherwise, update your existing stack and provide these parameters. Custom Domain NameEvery time your Minecraft server starts it'll have a new public IP address. This can be a pain to keep dishing out to your friends. If you're prepared to register a domain name (maybe you've already got one) and create a Route 53 hosted zone, this problem is easily fixed. You'll need to provide both of the parameters under the DNS Configuration (Optional) section. Whenever your instance is launched, a Lambda function fires off and creates / updates the record of your choosing. This way, you can have a custom domain name such as "minecraft.mydomain.com". Note that it may take a few minutes for the new IP to propagate to your friends computers. Have patience. Failing that just go to the EC2 console, and give them the new public IP address of your instance. FAQDo I need a VPC, or Subnets, or other networking config in AWS? Nope. The stack creates everything you need. What if my server is terminated due to my Spot Request being outbid? Everything is stored on EFS, so don't worry you won't lose anything (well, that's partially true - you might lose up to 5 minutes of gameplay depending on when the server last saved). There is every chance your instance will come back in a few minutes. If not you can either select a different instance type, increase your spot price, or completely disable spot pricing and revert to on demand pricing. All of these options can be performed by updating your CloudFormation stack parameters. My server keeps getting terminated. I don't like Spot Pricing. Take me back to the good old days. That's fine; update your CloudFormation stack and set the SpotPrice parameter to an empty value. Voila, you'll now be using On Demand pricing (and paying significantly more). How do I change my instance type? Update your CloudFormation stack. Enter a different instance type. How do I change my spot price limit? Update your CloudFormation stack. Enter a different limit. I'm done for the night / week / month / year. How do I turn off my Minecraft server? Update your CloudFormation stack. Change the server state parameter from "Running" to "Stopped". I'm done with Minecraft, how do I delete this server? Delete the CloudFormation stack. Done. I'm running the "latest" version, and a new version has just been released. How do I update my server? You can force a redeployment of the service via ECS. Update the service, and select How can I change map settings, server settings etc. You'll need to have remote access to the server (refer to Optional Features). You can make whatever changes you want to the configuration in
I can no longer connect to my instance via SSH? Your public IP address has probably changed. Check your public IP address and update the stack, providing your new public IP address. What's Missing / Not Supported?
Expected CostsThe two key components that will attract charges are:
AWS do charge for data egress (i.e. data being sent from your Minecraft server to clients), but again this should be barely noticeable. Help / SupportThis has been tested in the Ohio AWS region (verify your AWS region of choice includes t3.medium @ https://aws.amazon.com/ec2/spot/pricing and/or change as needed). Your mileage may vary. If you get stuck, create an issue and myself or someone else may come along and assist. Be sure to check out the repository on GitHub. Unless your question is specifically related to the AWS deployment, you may find the information you're after there: Stack gets stuck on CREATE_IN_PROGRESSIt may be because the In the below example (Paris), Restarting the ContainerVisit the ECS dashboard in the AWS Console.
Basic Docker DebuggingIf you SSH onto the server, you can run the following commands for debugging purposes:
DO NOT restart the Minecraft docker container via SSH. This will cause ECS to lose track of the container, and effectively kill the restarted container and create a new one. Refer to Restarting the Container above for the right method. ThanksThanks goes out to itzg (and contributors) for maintaining the Minecraft Docker images. Big shoutout to Factorio Spot Pricing. Couldn't have done this without it. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论