Skip to content

AWS Notes (old) Home

Clemens H. Cap edited this page Jun 26, 2024 · 1 revision

Table of Contents

Preparations

Step 1: Choose family name

  • This project knows of a parameter called *familyname* which identifies a specific type of tasks.
  • A *familyname* must contain lowercase letters and numbers.

Step 2: Prepare the family infrastructure

  ./prepare.sh  *familyname*
  • Creates a repository in the AWS ECR elastic container registry, where we will store all the versions of the images
  • Creates a directory structure where we will do the programming
    • src: For the source files
    • def: For the task definition files
    • files: For the files to be copied in into the elastic file system mounted by the task
    • build: Used internally in the build process
  • Copy in working boilerplate code into this structure

Building the Image

Step 3: Do the programming

Inside of directory familyname/src

  • Write up a file Dockerfile, see example
  • Write up a file entrypoint.sh and provide chmod 700, see example
    • In Dockerfile use as entrypoint ENTRYPOINT ["/entrypoint.sh"]
    • In Dockerfile do not forget to copy using COPY entrypoint.sh /
  • Write up a .dockerignore if necessary
  • Write up a buildspec.yml file, describing the steps to be taken in the build process, see example

Step 4: Build Project

  ./build.sh *familyname*    # do this in the main directory, as before, not in the task directory

This command

  • Prepares an S3 bucket as input source of the build process
  • Creates a service role for the build process
  • Creates a build project
  • Kicks off the build process
  • Sends us an email as soon as the build process has finished (provided we did the configuration properly as described in Create Email Notification)
In case changes are made in the project: Repeat all steps after 3

Defining the Task

Step 6: Define a task context

  • Adjust the files in the def directory, if necessary
  • Then register the task definition by calling (in the main directory)
  ./task.sh *familyname*

Running the Image

Step 7: Start the project tasks

  ./start.sh *familyname*  *task-definition-number*

This command

  • creates a cluster
  • creates a service running the requested number of tasks
To find out the existing (and: the last) numbers of task definitions: ./taskDefinition.sh *familyname*

Using the Image

Step 8: Use the project

  ./use.sh *familyname*
  • Lists all running tasks and discovers the public IPs to which they have been bound
  • Then we can connect to the service at the required IP addresses

Step 9: Stop the project

  ./stop.sh *familyname*
  ./clean.sh *familyname*  # cleans only cluster and service

Ultimate cleanup

Step 9: Cleanup Project

  ./cleanAll.sh *familyname*  # cleansalso build project and repository