Rand Stats

CLI::AWS::EC2-Simple

zef:p6steve

PLEASE EXERCISE CAUTION USING AWSCLI SINCE IT WILL CREATE BILLABLE AWS SERVICES IN YOUR ACCOUNT AND MAY NOT TERMINATE THEM AUTOMATICALLY

Raku CLI::AWS::EC2-Simple

This module provide a simple abstraction of the AWS command line interface, aka awscli, for Amazon's EC2 compute web service.

If you encounter a feature of EC2 you want that's not implemented by this module (and there are many), please consider sending a pull request.

Getting Started

Usage

./raws-ec2 [--id=<Str>] [--nsu] [--eip] [-y] <cmd>
  
    <cmd>         One of <list launch setup connect state stop start terminate nuke>
    --id=<Str>    Running InstanceId of form 'i-0785d8bd98b5f458b'
    --nsu         No setup (suppress launch from running setup)
    --eip         Allocates (if needed) and Associates Elastic IP
    -y            Silence confirmation <nuke> cmd only

Will make an (e.g.) MyKeyPair1672164025.pem from your credentials in your $*HOME dir

Config

launch reads aws-ec2-launch.yaml which is preloaded with the standard AWS Canonical, Ubuntu, 22.04 LTS, amd64 jammy image build on 2022-12-01. Edit this yaml file to meet your needs...

instance:
    image: ami-0f540e9f488cfa27d            # <== the standard, clean AWS Ubuntu
    #image: ami-0ebdbe39cf24185c1            # <== AWS Ubuntu plus raws-ec2 setup already applied (use --nsu flag)
    type: t2.micro                          # <== the basic, free tier eligible test machine
    #type: c6a.4xlarge                       # <== my choice of reasonably priced server class machine
    type: t2.micro
    storage: 30                             # <== EBS size for launch
    security-group:
        name: MySG
        rules:
            - inbound:
                port: 22  
                cidr: 0.0.0.0/0
            - inbound:
                port: 80
                cidr: 0.0.0.0/0
            - inbound:
                port: 443 
                cidr: 0.0.0.0/0
            - inbound:
                port: 8080
                cidr: 0.0.0.0/0
            - inbound:
                port: 8888
                cidr: 0.0.0.0/0

PLEASE REVIEW SECURITY GROUP RULES AND ADAPT TO YOUR NEEDS - SPECIFICALLY REMOVE THE PORT:22 RULE UNLESS YOU WANT ALL IPS TO HAVE ACCESS

Setup

setup deploys docker, docker-compose, raku and zef to the launchee...

#!/usr/bin/perl
`sudo apt-get update -y`;

`sudo apt-get install rakudo -y`;
`sudo git clone https://github.com/ugexe/zef.git`;
`sudo raku -I./zef zef/bin/zef install ./zef --/test`;

`sudo apt-get install docker -y`;
`sudo apt-get install docker-compose -y`;

Wordpress Deploy & Control

[This section will probably go into raku-CLI-WP-Simple]

viz. digital ocean howto

NOTES

copyright(c) 2022 Henley Cloud Consulting Ltd.