What Is AWS Elastic Beanstalk?

You need a Golang development environment set up on your machine to follow along in this section.

In your root project directory, create a folder namedstaticand create anindex.htmlfile in it.

Deploy Golang to AWS EB article cover

Copy and paste the following code into the HTML file and save it.

Return to your project root directory and create anapplication.gofile.

Copy and paste the code below into yourapplication.gofile and save it.

Terminal output for commands to create new Go project

Elastic Beanstalk by default uses an NGINX configuration that forwards requests to your system on port 5000 only.

You now have your sample tool built and ready for deployment.

In the next section, youll be deploying the program to AWS Elastic Beanstalk.

website preview in localhost

If currently you dont have an AWS account, go toAWSs sign-up pageto create a new one for free.

And to shut down your system and all its resources, you’re able to runeb terminate.

You have now successfully deployed a Golang web tool to AWS Elastic Beanstalk using the Elastic Beanstalk CLI tool.

run eb init command output

credential setup step in eb init

name eb applicattion

select application platform in EB

setup ssh for your application’s instances

create and deploy your application eb create application

eb web app displayed in browser when you run eb open