Difference between revisions of "Using Amazon Webservices"

From TempusServa wiki
Jump to navigation Jump to search
old>Admin
 
(6 intermediate revisions by 2 users not shown)
Line 47: Line 47:


== Increasing storage on running instance ==
== Increasing storage on running instance ==
Note that the fowllowing operation can be done while the server is running
Note that the following operation can be done while the server is running


In the AWS console
In the AWS console
Line 53: Line 53:
# Update "Size" and press  "Modify"
# Update "Size" and press  "Modify"


From the econsole run
From the econsole run<syntaxhighlight lang="bash">
lsblk
</syntaxhighlight>Check that the partitions match "nvme0n1" and "nvme0n1p1" and grow the partition and update the file system<syntaxhighlight lang="bash">
sudo growpart /dev/nvme0n1 1
sudo resize2fs /dev/nvme0n1p1
</syntaxhighlight>In case you are using an XFS filesystem a result will occur complaing about a bad superblock. Then you need to grow the root partition using:<syntaxhighlight lang="bash">
sudo xfs_growfs -d /
</syntaxhighlight>


  lsblk
Finally check size is incresed with <syntaxhighlight lang="bash">
 
df -h
Check that the partitions match "nvme0n1" and "nvme0n1p1" and grow the partition and update the file system
</syntaxhighlight>
 
  sudo growpart /dev/nvme0n1 1
  sudo resize2fs /dev/nvme0n1p1


=== Variant: Main volume ===
In case you are using the main volume, instead try
In case you are using the main volume, instead try
 
<syntaxhighlight lang="bash">
   sudo growpart /dev/xvda 1
   sudo growpart /dev/xvda 1
   sudo resize2fs /dev/xvda1
   sudo resize2fs /dev/xvda1
</syntaxhighlight>


Finally check size is incresed with
=== Variant: LUKS volume ===
Find the crypt partition
<syntaxhighlight lang="bash">
  ls /dev/mapper/
</syntaxhighlight>


  df -h
Fill the space (in above we found crypt-sdf)
<syntaxhighlight lang="bash">
  sudo cryptsetup resize /dev/mapper/crypt-sdf
  sudo resize2fs /dev/mapper/crypt-sdf
</syntaxhighlight>

Latest revision as of 21:34, 6 February 2023

Getting started with EC2

The following images are quite suitable as base images

  • amazon/amzn-ami-pv-2013.09.0.i386-ebs
  • amazon/amzn-ami-pv-2013.09.0.x86_64-ebs

Note the above images require that you use ec2-user for SSH access.

Instance type recommendations

  • Normal systems: small or medium
  • Test or development: micro

Storage options

Two scenarios exist

  • Simple setup data and application in one
  • Confidential data in an separate encrypted storage

For a separate storage you should do the following

  1. Create a new EBS partition
  2. Mount to suitable point
  3. Encrypt and login using LUKS

Note that LUKS partitions may contain multiple passwords, and do not need to be at rest when copy/backup operations are active.

Stuff to do in Amazon linux

After booting images

  • Set your timezone
  • Enable routing: Port 80 to 8080
  • Activate SMTP service [option]
  • Install MySQL
  • Install Tomcat
    • Deploy connection pool drivers
    • Deploy MySQL JDBC driver

After that just follow the normal install procedure for webapplications

  • Deploy the war file
  • Set up connection pool for the application

Maintaining the solution

Tips for maintaing you solution

  • Consider instance termination protection
  • Backup: Can be taken as EBS snapshots
  • Monitor: Activate CloudWatch for the instance


Increasing storage on running instance

Note that the following operation can be done while the server is running

In the AWS console

  1. Rightclick the volume and select "Modify volume"
  2. Update "Size" and press "Modify"

From the econsole run

lsblk

Check that the partitions match "nvme0n1" and "nvme0n1p1" and grow the partition and update the file system

sudo growpart /dev/nvme0n1 1
sudo resize2fs /dev/nvme0n1p1

In case you are using an XFS filesystem a result will occur complaing about a bad superblock. Then you need to grow the root partition using:

sudo xfs_growfs -d /

Finally check size is incresed with

df -h

Variant: Main volume

In case you are using the main volume, instead try

  sudo growpart /dev/xvda 1
  sudo resize2fs /dev/xvda1

Variant: LUKS volume

Find the crypt partition

  ls /dev/mapper/

Fill the space (in above we found crypt-sdf)

  sudo cryptsetup resize /dev/mapper/crypt-sdf
  sudo resize2fs /dev/mapper/crypt-sdf