Palworld Dedicated Server Guide on AWS | Run Palworld on AWS

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
this video is all about showing you how to host your own dedicated po World server on Amazon web services or AWS maybe you want to run your own dedicated po World server so that all your friends can join in and play but your home network or your computer they're just not reliable or powerful enough to do so so you go to nitr or some other server hosting company and you rent a power World server from them but over the course of playing realize you want more control for some people they're fine with the amount of control that these dedicated hosting platforms give them but others want full control they really want to be able to dig into that operating system now if you're new to AWS don't worry this video is designed for both beginners and people who do have experience with AWS I'll show you how to create an AWS account and we're going to use a terraform module that I've published to create our pow World server and infrastructure and install power world and terraform is an infrastructure as code tool where we describe how we want to deploy our server and all the resources instead of clicking through the UI and saying I want a server and I want it configured like this we describe it as code and we deploy it that way now I can already hear the people in the comments saying why would you run this on Amazon web services it's too expensive I am never going to financially recover from this when compared to a game hosting platform like nitr or some other platform and to that I would say you are correct if you leave the server the actual physical server that we're going to create running 24 hours a day 7 days a week it will be more than a hosting platform like nitr or some other platform however we can reduce these costs and if you manage them properly it can actually be cheaper than those hosting platforms so if you stay tuned to the end of the video I'm going to going to go over some cost-saving tips how we can automatically start and stop our instance when we're maybe not using it and how we can set up cost budget alerts so that if our budget is expected to go over budget we can get an email and be alerted to that so obviously the first thing we need is an AWS account so if we go to Google and we just simply type in sign up for AWS the first link it brings us to is sign up for a free AWS account and then once we're there we're going to hit create a free account now AWS accounts are free by their nature they have what's called a free tier in which you can use certain things for a specified period of time and when that time expires it is no longer free but while you're in that free tier trial you can use things that are outside of the free tier and you'll begin to occur a cost and it should be noted that when we run pow World in order to run a powerful enough server we won't be dealing with the free tier so you will need a credit card of some sort in order to begin using AWS for po world go ahead and fill in these boxes follow along with all of the prompts it should take you anywhere from 5 to 10 minutes you will need a valid credit card and your address phone number and email address and here's where they ask you for your billing information and this is required note they will not charge you for usage of AWS free tier limits right if you stick within those limits you won't get charged but for our purposes we will be exceeding those limits so we will be getting charged so you will have to provide this here once you get to the point after you've confirmed your identity it says sign up for ads you pick a support plan um we don't need developer or business support we just we'll do basic support and then we'll hit complete sign up once you're logged into your AWS account you'll see this Services tab up here on the left and this is a list of all the services that we can use within AWS we will be primarily focusing on ec2 S3 and IM am for the purposes of this video if you feel like going through here and exploring feel free but let's move on to installing the other piece we need for the video and that is terraform now you can simply Google install terraform and you'll probably get these two links so this one install terraform leads to the tutorials section of the Hashi Corp docs and this one brings you to the actual page where you can download the packages so if you click on this first one you get a small video on how to download and install terraform and then they have a little tutorial that you can follow you pick your operating system are you on Windows Linux manual installation and then that second link install terraform and I'll put a link to both of these in the description this has all the packages so you can download and install them manually and that's what we're going to do so if you're on Linux you probably know how to use your package manager if you're on Ubuntu you know just follow these instructions if you're on red hat Cent OS right to install terraform pretty simple if you're on Windows you know it gets a little more complicated now I'll be doing this on Windows because I expect most people watch watching this video are new to terraform and running that from Windows so we'll start with that so again I'll put the link in the description but we're going to go to the windows binary download and we're going to go to amd64 unless you are in a 386 architecture system but 99% of you are on amd64 systems and we'll hit download so you should have this ZIP file in your downloads folder or wherever you downloaded it to go ahead and open that up and we need to extract this to our computer somewhere so I put mine in the F drive I have a folder labeled terraform and that is where I put all of my terraform executables but you can put it anywhere on your computer now the second thing I have to do is I have to tell Windows where terraform is the path on the computer to the terraform executable so to do that we'll simply search for environment variables and we'll hit edit system environment variables that'll open this window here and we'll simply go to environment variables and then under user variables we will go to path open that up and we will simply add the path to the terraform executable so you can hit new and then wherever on your computer it exists right if it's on your C drive terraform folder you would do that and so now when you run the terraform command terraform will look through all of the these paths and say which one contains terra. exe and it will run it from there so you can see I've already configured the path F Drive terraform folder because that is the folder that terraform exz is in on my computer so then you can hit okay okay and okay and now to test it you can open command prompt or Powershell and you can simply type terraform Das version and that should return a valid terraform version and so you've successfully installed terraform on windows so now that we've got everything we need to start deploying our po World server on terraform real quick tell me you're using visual studio code it is an IDE integrated development environment if you don't have it highly suggest you download it and install it it's not needed for this video but if you're into this kind of stuff cloud terraform code software engineering right you're going to want Visual Studio code so the first thing we need to do is we need to create like our working environment right we're going to be running terraform from a folder or directory so we need a place to create terraform configuration files and run terraform from so I've created on my desktop this pow World terraform folder it can be anywhere on your computer doesn't really matter and this is going to be my working directory where I'm going to create my terraform files and run terraform from so if you're not interested in using a visual studio code right you could simply just open Powershell and go to this directory and you could work from here it's the same thing but for those of you who like making life easier and you have Visual Studio code installed we're going to go to Open folder and we're going to go to that folder that we created and we're going to hit select folder and so now we're we're in that folder but in Visual Studio code so over here on the left inside the folder right we're going to click we're going to create new file and we're going to call it main.tf now we're beginning to write our terraform code so what we're going to be using is what's called a terraform module so the first place we're going to start and I'll leave a link in the description is this terraform module that I have written real quick what's a terraform module well a module in terraform is essentially a piece of code or a configuration of terraform code that you've written and then packaged it and published it to what we call this terraform registry so if I go to browse modules right there's modules for all sorts of things people have already written it so I don't have to go back and write it myself when I want to do it I just use somebody else's module you can think of this is like a python package or a go package right somebody's written it I'm just going to download it and provide whatever inputs they've made available so if you look at this module page here and again I'll leave a link in the description we've got a readme and this comes from the GitHub readme with some instructions on how to use this we've got inputs these are the available inputs you can provide to the module outputs the available outputs that will give you any dependencies and any of the resources that could potentially be created by this module there's a source code link here and if I click that it brings me to the actual code for this terraform module and the readme is here as well and the readme in GitHub actually renders pictures so if you're going to follow along with the readme I suggest you go to the GitHub page there's also some examples in here so if you click on the examples folder these are examples of using po World in different scenarios do you want to enable backups what does that look like do you want to bring an existing powor settings.ini file from an existing server what does that look like restore from backup right you've got existing game saap files and you want to migrate from one server to This Server there's ways to do that right so if we click on this vanilla power world example you can look at the read me and these are the relevant inputs there's some example files here right if you were going to use this module as an example what would it look like just make sure you change the source we'll go over that in a minute so back on the module page p over here on the right where it says provision instructions we're going to copy that and over here in our main.tf we're going to paste that there and so this is telling terraform we would like to use a module and we're going to call it pal world and this is where we're going to get the module from and this is the version of that module we want because you can call a specific version or you can even do like greater than equal to or you can even remove it because it's not required and then in here within these squiggly brackets ETS in this module block we need to Define our inputs so back here these are our available inputs right this is everything you can pass and you'll see each one of these has a description about what it is and a default value so if you don't specify an input right you don't have to specify all 91 inputs you only need to specify the ones you care about and if you don't provide them then the default will be used so for instance this PO World setting collection drop rate you can specify this input set it to Che and it will use that one but if you don't it will just keep it as one and if you look at the read me and you scroll all the way down there's actually a section called inputs that has more detailed information in a more shall we say I pleasing format on what each one of these inputs does so I'm going to go to examples and we're going to do van power world with default settings and I'm just going to copy all of these inputs and then I'm going to go back to my main CF file and in the module block I'm going to paste all of those now we're not going to go and edit every single input that would take way too much time but I'm just going to go over the important ones and we're going to change a few and then we're going to get our server up and running so instance type this is the type of AWS instance you would like to use there's a lot of them there's a lot of different configurations this specific one T3 extra large it is going to run you anywhere from three to four dollars a day this is the most expensive part of this entire thing is the actual server the larger it is and the longer it runs the more money it costs if you're not using the server you can turn it off and that won't cost you any money stay tuned to the end of the video and I'll show you how to save some money and how to set up budgets this particular instance type is what we call a burstable instance it's four CPU cores 16 GB of RAM so I'm going to leave this T3 extra large for now because the power world technical docs if we can call them that say they recommend at least 16 to 32 gigs of RAM create SSH key we're going to leave this true and I'm going to show you how to create an SSH key right now and then we're going to have to provide the SSH key public path that we create and this is going to upload our SSH public key to the server so that when it's created we can get into it to look at what's going on and to troubleshoot to create an SSH key pair if you're using visual studio code you can just go up here to terminal hit new terminal that's going to open a Powershell window down here at the bottom and we're just going to use the ssh-key Gen command and it's going to prompt us for the name of the key and I'm just going to call it Po and I'm just going to call po world not going to give it a passphrase and that's it and you'll see over here on the left it has created these keys inside of this folder here now if you're following along the video but you're not using visual studio code you can just open like command prompt or Powershell and the same command will work from there as well right so if you're not using visual studio code it's still possible so with my SSH key created I need to provide the path relative to this working directory so relative to the f fer that I'm in the path to this file so since the file is in the same folder all I need to do is provide pal world. Pub and so when the server gets created it's going to upload this key to the server and then I'll use this one the private key to connect to that server so public key gets put on server I use private key to connect to server so on to the power world settings so before we move on to these right basically anything you provide here is going to end up in powor settings.ini now if you also use this input use custom power world settings that file and those settings will be used and all of these will be ignored so just keep that in mind you can't use a custom inii file and also edit these and expect these to overwrite your file it's not going to work so real quick we're just going to edit some things here so let's speed up the daytime speed um you know let's increase the EXP rate um you can change the death penalty if you want um you know let's turn on Friendly Fire I'll take one of those I'll take one of these let's make sure we give our server and name that mean something to us so let's do let's just call it AWS po World test and we can give it a server description I'm just going to leave it alone and now now admin password um so this is going to be the password required to actually use like admin commands in game and connect with archon if you enable archon public IP you don't have to fill it in um you can if you want to and then region also you don't have to fill it in but you can if you want to now there's one more file I want to create and that has to do with outputs and now we don't need this in order for this to work but it makes our life easier so I have created this module to Output five things when it's finished running some information and one of those things is actually the public IP so after it gets created it'll spit out the public IP so then we can use that to connect in the event we can't find our server in the server list but in order for this to work we have to come over here to our terraform working directory and we have to create a file called outputs. TF and if I didn't mention it before terraform files end in the extension. TF it doesn't matter what you name these files as long as they end intf but I am using the best practices naming convention that I recommend you use if you're getting into writing terraform so I'm going to take these outputs actually from if I go to the source code for this module and I go to examples and I go to vanilla power world settings and I look at output stat c f I'm actually going to just copy these and I'm going to paste them in there all right so now that we have created our terraform configuration and we have an AWS account the last step to getting this all work and tied all together is we need to tell terraform how to connect or authenticate to our AWS account so this video is by no means here to teach you how to become a terraform expert or an AWS expert I am just giving the basic tools needed to do what we need to do for this video so terraform has a concept of providers and a provider is essentially how you tell terraform to connect to whatever you're attempting to create something in and we are attempting to create things in AWS so we need the AWS provider now the module requires the AWS provider so when we run terraform it will download it and use it but we have to tell the provider how to connect to AWS which means we have to basically give it a US username and password of some sort so in order to do this log into your AWS account and go to am the IM am service now if you're logged in as the root account and if you just created your account you probably are logged in as the root account you'll see these security recommendations that you should uh deactivate or delete access keys for the root user now I'm not here to teach you how to be an AWS expert but you should know that it is best practice to come over here to users and create another user and then log out of the root user log in as that new user and use their access keys because if you're going to use the root access keys right then some if somebody gets access to those if you accidentally upload those to GitHub then someone gets access to your entire AWS account whereas if you were to create a user and give them only the permissions they need if someone got those access keys they would have very limited they would have a very limited ability to do damage to your account so for the purposes of this video because this is meant to be beginner friendly I not going to create a user and go through that whole process you're going to log in as the root account or if you're experience log as the user with the correct permissions and you're going to go to manage access keys and you're going to see a section called access Keys here now you shouldn't have any access keys or you might might have uh like one set of access keys but you should be able to click on the create access Keys button over here on the right and when you click create access key it's going to ask you if you understand and again you're going to get the warning about the root user key and it's going to give you that access key and a secret access key so this is essentially your username and this is your password so go ahead and copy these put them somewhere safe and then you can go ahead and hit done so now we have to give terraform this access key and secret key so that it can connect so the AWS provider we can hardcode these credentials into a provider block although that's not recommended because if we accidentally put this code somewhere say GitHub now someone has access to this key and so you see where the danger lies in using those root access Keys the way we're going to do it for this video is we're going to set environment variables so so if you're on Linux all you need to do is copy these commands and then change these values to use your AWS region your access key and your key ID and real quick if I didn't explain what a region was yet in AWS on the top right you'll see like North Virginia or some other region this is what they mean by region so depending on where you want to deploy your server right if you obviously if you live in Europe you're going to want to deploy a server in Europe not Us East one now if you're on Windows this command you're not going to be able to copy and paste it we've got to set the environment variables and that's different when it comes to Windows if you're using Powershell or command prompt so back in VSS code I'm going to open a new terminal again this is going to open up my Powershell command prompt and just like all the times before you don't need Visual Studio code to do this you can simply just open a Powershell window and that's the same thing as this terminal here so the equivalent command in Powershell to those export commands would be and I'm just going to open a new file right here and call it temp this command here so dollar sign EnV colon and then our environment variable and the value so go ahead and take that access key ID and that secret access key and the region you would like to deploy into and go ahead and modify this real quick so I've gone ahead and edited these environment variables and now I'm just going to go ahead and paste them into my Powershell window and hit enter and now all three of these should be set so now when I go to run terraform it's going to look at the environment variables and be like hey I found an Amazon web services username and password and region I will deploy all of these into that account so with that said we can begin to run our basic terraform command so we're always going to start with a terraform a nit and this is going to download our AWS Prov provider but it's also going to download our po World module from that registry and then once that's initialized ideally we want to run a terraform plan and that's going to tell us if everything's going to run properly and what's going to get created based on the inputs we've provided so if we look through this list and if you're you've never used terraform and this looks like gibberish some foreign language to you essentially terraform creates sources like a network interface with an IP address an AWS instance which is the server and it creates it based on the inputs we've given it and then and then once terraform finishes creating all these resources we will have these outputs potentially such as our power World server public IP and terraform will kind of spit that out for us when it's done applying so we're going to create 11 resources so now we're going to run a terraform apply now when you run terraform apply it's going to run terraform plan again but this time it's going to ask you if you really want to do this and you're going to have to type yes in order to do it and so then we do that and tarform goes and it creates everything for us it's creating our server it's connecting everything and then when it's done we'll get some outputs such as our IP address all right so ter form finished it took all of 30 seconds to create all of that infrastructure and now we have our IP address so before we continue let's go over to AWS and check out what got created so in the AWS console go up to the search bar in the top left and search for the ec2 service and this is the service used to create those compute server instances and we can see our pow World server is actually here and it takes the server name as the name of the server and we can see it's initializing but and then we can see some data about it like the public IP address but we already know that because terraform output that for us you can see under the security tab right what are we allowing traffic we're only allowing traffic on Port 22 so we can ssh in and Port 8211 for po world we so now we're going to go ahead and connect to this server so I can show you what's going on in here so we're going to do a command and we're going to ssh in we're going to use SSH dasi and then the name of the private key so that would just be pal world and then we do the username of the server that we want to ssh in as and that would be Ubuntu at and then the IP address and yes and we're probably going to get an error oh we did not get an error okay um sometimes you get an error about the permissions for power world being the SSH key the private key being to open if that happens I will put a video on the screen right now and a link in the description to another YouTube video I have that helps you solve that issue so then once you're in you're going to be looking for the pow World server directory so you're going to CD slow world- server I'm going to do an LS and because I see all these files that means po world has finished uh installing now if you don't see all these files in here that just means power world is still in the process of installing it takes anywhere from 5 to 10 minutes for this process to fully complete and once you're in the server you can actually do Journal CTL dxu Cloud dfinal to view that install script so if I hold space I can scroll all the way down right and it shows me what's going on here right so if there's ever an issue or any errors you should be able to troubleshoot it based on whatever is happening in this script and then if we run system CTL status po world we can see if po world is running or not so it's green it is active and running and we can see this output here which means po world is running it's up and running we should be able to connect to it and then the last thing we want to do while we're in here is we want to go into pal we want to look in saved config Linux server and we want to make sure po World settings and we want to do cat pal World settings just make sure some of the settings we set actually took effect so you know we're looking for daytime speed rate three that is what we set exp rate four right so we we know our settings took effect so let's go ahead and actually try to connect with power world so in power World you'll just join a multiplayer game like you normally would um you can attempt to search for that server name that you set um however I have not been successful with this yet I don't know why it doesn't show up I think it's bugged I have seen other people report the same problem so we can connect um down here with the IP address and Port so go ahead and grab that IP address of your server and you can get that from the terraform outp put or you can go to the AWS console and click on the server and it's in the details and then just go ahead and paste that and the port number and hit connect and assuming uh that you can connect and everything is up fine which it should be you'll be prompted to create a character and there we go I've connected and I've been prompted to create a character so once you're done you can go ahead and actually exit the SSH session if so you're no longer in there and if you determine you no longer need this server you can simply run a terraform destroy and that will go ahead and destroy everything it will completely wipe away everything so you don't have to worry about having a server sitting around or an IP address or anything erroneous hanging out in your AWS account and everything's gone finished phito so if you like this video and you like this module go ahead and head on over to GitHub Link in the description go ahead and St this repo if you'd like to contribute I'm open to that as well if you have any issues go to the GitHub repo click issues go ahead and open an issue if you hit new issue you can open a feature request that you might have a bug that you run into you can even just ask a question so if you stuck around to the end of the video I did promise you some moneys saving tips when it came to using a WS now the majority of your cost is going to come from the actual ec2 instance running itself you know you don't get charged when it's just sitting there off but you do get charged when it's running that's where the majority of our cost is coming from so AWS actually has a calculator I'll leave a link in the description and we can estimate these costs real quick so if we come to the estimator and we choose ec2 for our service right we know we need four cores and 16 gigs of memory and so it doesn't really matter what we choose right now I've shown you the example T3 extra large if I do on demand so I'm not using a cost savings plan with 100% utilization meaning I leave it running 24 hours a day 7 days a week it's going to cost me $121 a month so roughly that $4 a day um and you know we can kind of play around with this we can choose different servers right and the cost kind of goes up or down by a few dollars um but it doesn't change all that much I think the cheapest would be the t4g extra large and you know it goes down down to $98 a month but that's still pretty substantial and then we can't use spot instances because we can't have our server just disappearing on us while we're using it but what we can do is we can control the utilization of This Server so if I were to say move this down to 40% usage of the month well now that's a little more U manageable $40 a month um so if we break that down into hours a day right so maybe I only need to play five hours a day I come home from work and I only KN I only leave the server on for 5 hours a day because that's how long me and my friends have to play or or maybe hours a week so you know maybe on the weekends me and my friends we all just have a gaming binge and we play for 15 hours a day so 30 hours a week right a lot more manageable so so one of the best ways we can save on costs here is just turning off the server when we're not using it now I realize that doesn't work for everybody because sometimes you want your friends to be able to log in and you have different schedules you know when you're asleep they want to play vice versa and in those instances there's really nothing we can do about that um and that is when it would make more sense to probably go with a server hosting platform but the main benefit of using your own AWS service is you get that maximum control so the most efficient way to do this is if you know or you have pretty consistent time frames maybe you and your friends can only play 3:00 p.m. to Friday to 5:00 p.m. on Sunday then you can set an auto schedule for these instances to stop after 500 P p.m. on Sunday and start again on 300 p.m. on Friday but if you'd rather just you know start it when you need it and stop it when you don't I'm going to show you to do that manually real quick you can go to the ec2 service and you can go to your power World server or instance you can click on it and over here and over here in the top right you can hit stop instance now that will not destroy it it will not destroy your server or your data it will not hurt your pow World server it will simply turn the computer off then when you're ready to start it again you can instance State and start instance now if you're interested in Autos scheduling when these start and stop you will go over to the cloud formation cloud formation service and we will create what's called a stack and we will keep template is ready an Amazon S3 URL as a default settings and we will paste this URL link and I'll put a link in the description to this URL as well and we're going to hit next and this stack is basically going to create a Lambda function that runs every now and then to look at all the instances and say which ones are tagged a specific way and do I need to turn them off or start them so we'll give it a name this will be EC to auto start stop name it whatever you want and for the parameters the instance scheduler tag name and this tag is how the auto start and stop function knows which servers to start and stop on which schedules and we'll see that in a minute but we'll just leave this as schedule and then we'll leave all of this the same but frequency come down to frequency this is how often the Lambda function is going to run to figure out if it needs to start or stop a server every time a Lambda function runs it costs money but it's fractions of a fraction of a scent um but it you know we don't really need it to run every 5 minutes so I'm just going to set that every 60 minutes I'm going to leave everything else the Same by default this will run in the US East one region if you want it to run in a different region provide your region here and then I'm going to leave everything else the same and hit next I'm not going to mess with any of this I'm going to hit next again I'm going to scroll down I'm going to acknowledge and I'm going to hit submit so now you can see our stack is being created and you'll see that cloud formation is creating all of these resources that were in our stack if we actually click on resources we can see all the resources that are going to be created and don't worry about pricing when it comes to this a lot of this stuff is free or it cost fractions of a fraction of a fraction of a penny us dollar Penny uh when it runs um and I know it so I know it might look scary but trust me when I say this is not where your costs are going to come from it is going to be that instance running so once your stack is created you'll go up here in the top left to the Dynamo DB service because the Dynamo DB table got created with this stack if we go to tables we can see our config table here and then over here on the right we're going to hit explore table item so in here we have schedules and we have periods and a schedule correlates to a period so when we tag an instance with our schedule key we tell it which schedule in here we would like to use to start and stop our instance so if we look at the example one Seattle office hours schedule if we were to set that as our tag value then our period would be office hours and then if we look at office hours period we start or begin at 0900 and we stop at 1700 so we already have a period configured here weekends and if we look all the way over to the right we can see that Saturday and Sunday are set so if we only want our instances running on the weekend we can click on the running schedule we can go to add a new attribute we will add a string set we will add periods and then weekends and we'll save and close so then we can go to ec2 servers and ideally you would do this as code with terraform click on your server and then go to tags hit manage tags on the Right add a new tag and this one's going to be schedule and the key will be right running schedule running click on it tags schedule running it is case sensitive so make sure these are lowercase hit save and now this server should only run on the weekend all right one last thing to go over and we're going to set up a budget alert so you can come up here to the top left search bar and you can search for billing and and you want billing and cost management and under the budget and planning section on the left you want to look for budgets and then on the right here you have the option to create a budget and so you can use a template or you can customize it we're just going to use a template for ease of use and you can set up these different budgets right so a zero spend budget is basically if I am going to spend anything over $0 send me an email or you can do a monthly cost budget so let's do that you want to give your budgeted name so monthly allowance you want to enter the budgeted amount so if you're estimated to go over this amount this is when we will send you an email so if you've only got $50 a month to spend if we think you're about to spend over $50 a month we'll send you an email and then you want to put the email address of the people or person that you want to receive this email when this budget's about to go over right and then you'll just hit create budget and there you go and you can create multiple budgets as [Music] well
Info
Channel: The_Sudo
Views: 4,735
Rating: undefined out of 5
Keywords: Palworld, Guide, AWS, Terraform
Id: vY935NKVDzI
Channel Id: undefined
Length: 40min 16sec (2416 seconds)
Published: Sun Jan 28 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.