All notes
Aws

Basics

Network


# Get the FQDN:
hostname --fqdn

# Get the public IP of an instance using:
curl http://169.254.169.254/latest/meta-data/public-ipv4 && echo

# Get the instance host name
curl http://169.254.169.254/latest/meta-data/public-hostname && echo

Mail

Cybart: how to install and configure postfix on Amazon EC2.


sudo su
yum install postfix -y
# Stop sendmail (installed on Amazon Linux by default)
/etc/init.d/sendmail stop
/etc/init.d/postfix start

# Switch MTA from sendmail to postfix
alternatives --set mta /usr/sbin/sendmail.postfix

Migration between regions

Migration

Ref. Copy your instance into another availability zone via right click on the AMI. And you don't need necessarily to stop the instance.

Amzn Linux

Install packages

Docker

aws.docs: docker basics.


sudo yum install -y docker
sudo service docker start

# Add the ec2-user to the docker group so you can execute Docker commands without using sudo.
sudo usermod -a -G docker ec2-user
# Log out and log back in again to pick up the new docker group permissions.
# Verify that the ec2-user can run Docker commands without sudo.
docker info

FAQ

Open ports in Security Groups not working?

Question: After I opened port 80 and shadowsocks port (both tcp and udp) in the associated Security Group, I found I either could not telnet my AWS on port 80 nor the shadowsocks server port.

This ref gave me a good hint. The reason why I couldn't telnet on port 80 was because I hadn't started apache yet. The reason why I couldn't telnet on my shadowsocks port was because in my config file I specified "127.0.0.1" (loopback) as server IP, which is wrong, and actually "0.0.0.0" (all ip) should be set instead.

No makeinfo in aws?

When compiling emacs on aws, yum found no candidate for makeinfo which is needed by emacs to generate info. This page told me that actually texinfo is another name for makeinfo. And yes, yum can find texinfo.