Full Code of CaravanaCloud/aws-pod for AI

main affa84d24052 cached
22 files
69.9 KB
19.2k tokens
1 requests
Download .txt
Repository: CaravanaCloud/aws-pod
Branch: main
Commit: affa84d24052
Files: 22
Total size: 69.9 KB

Directory structure:
gitextract_qocb_8p6/

├── LICENSE
├── LICENSE.txt
├── README.md
├── labs/
│   ├── ami-multiverse/
│   │   └── README.md
│   └── vpc-debug/
│       └── tf/
│           └── main.tf
├── scripts/
│   ├── git-push-all.sh
│   ├── git-release.sh
│   ├── instance-policy.json
│   └── instance-trust.json
├── snippets/
│   ├── aws-cli-demo.sh
│   ├── cloudformation/
│   │   ├── hello-bucket.template.yaml
│   │   ├── sample-bucket.template.yaml
│   │   ├── sample-codebuild.template.yaml
│   │   ├── sample-database.template.yaml
│   │   ├── sample-instance.template.yaml
│   │   ├── sample-nested.template.yaml
│   │   ├── sample-network.template.yaml
│   │   └── template-configuration.json
│   ├── fio-test-disk.sh
│   └── user-data-alb-demo.sh
├── templates/
│   └── route53_cname.tpl.json
└── tutorial/
    └── ec2-wordpress-simple.md

================================================
FILE CONTENTS
================================================

================================================
FILE: LICENSE
================================================
                                 Apache License
                           Version 2.0, January 2004
                        http://www.apache.org/licenses/

   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

   1. Definitions.

      "License" shall mean the terms and conditions for use, reproduction,
      and distribution as defined by Sections 1 through 9 of this document.

      "Licensor" shall mean the copyright owner or entity authorized by
      the copyright owner that is granting the License.

      "Legal Entity" shall mean the union of the acting entity and all
      other entities that control, are controlled by, or are under common
      control with that entity. For the purposes of this definition,
      "control" means (i) the power, direct or indirect, to cause the
      direction or management of such entity, whether by contract or
      otherwise, or (ii) ownership of fifty percent (50%) or more of the
      outstanding shares, or (iii) beneficial ownership of such entity.

      "You" (or "Your") shall mean an individual or Legal Entity
      exercising permissions granted by this License.

      "Source" form shall mean the preferred form for making modifications,
      including but not limited to software source code, documentation
      source, and configuration files.

      "Object" form shall mean any form resulting from mechanical
      transformation or translation of a Source form, including but
      not limited to compiled object code, generated documentation,
      and conversions to other media types.

      "Work" shall mean the work of authorship, whether in Source or
      Object form, made available under the License, as indicated by a
      copyright notice that is included in or attached to the work
      (an example is provided in the Appendix below).

      "Derivative Works" shall mean any work, whether in Source or Object
      form, that is based on (or derived from) the Work and for which the
      editorial revisions, annotations, elaborations, or other modifications
      represent, as a whole, an original work of authorship. For the purposes
      of this License, Derivative Works shall not include works that remain
      separable from, or merely link (or bind by name) to the interfaces of,
      the Work and Derivative Works thereof.

      "Contribution" shall mean any work of authorship, including
      the original version of the Work and any modifications or additions
      to that Work or Derivative Works thereof, that is intentionally
      submitted to Licensor for inclusion in the Work by the copyright owner
      or by an individual or Legal Entity authorized to submit on behalf of
      the copyright owner. For the purposes of this definition, "submitted"
      means any form of electronic, verbal, or written communication sent
      to the Licensor or its representatives, including but not limited to
      communication on electronic mailing lists, source code control systems,
      and issue tracking systems that are managed by, or on behalf of, the
      Licensor for the purpose of discussing and improving the Work, but
      excluding communication that is conspicuously marked or otherwise
      designated in writing by the copyright owner as "Not a Contribution."

      "Contributor" shall mean Licensor and any individual or Legal Entity
      on behalf of whom a Contribution has been received by Licensor and
      subsequently incorporated within the Work.

   2. Grant of Copyright License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      copyright license to reproduce, prepare Derivative Works of,
      publicly display, publicly perform, sublicense, and distribute the
      Work and such Derivative Works in Source or Object form.

   3. Grant of Patent License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      (except as stated in this section) patent license to make, have made,
      use, offer to sell, sell, import, and otherwise transfer the Work,
      where such license applies only to those patent claims licensable
      by such Contributor that are necessarily infringed by their
      Contribution(s) alone or by combination of their Contribution(s)
      with the Work to which such Contribution(s) was submitted. If You
      institute patent litigation against any entity (including a
      cross-claim or counterclaim in a lawsuit) alleging that the Work
      or a Contribution incorporated within the Work constitutes direct
      or contributory patent infringement, then any patent licenses
      granted to You under this License for that Work shall terminate
      as of the date such litigation is filed.

   4. Redistribution. You may reproduce and distribute copies of the
      Work or Derivative Works thereof in any medium, with or without
      modifications, and in Source or Object form, provided that You
      meet the following conditions:

      (a) You must give any other recipients of the Work or
          Derivative Works a copy of this License; and

      (b) You must cause any modified files to carry prominent notices
          stating that You changed the files; and

      (c) You must retain, in the Source form of any Derivative Works
          that You distribute, all copyright, patent, trademark, and
          attribution notices from the Source form of the Work,
          excluding those notices that do not pertain to any part of
          the Derivative Works; and

      (d) If the Work includes a "NOTICE" text file as part of its
          distribution, then any Derivative Works that You distribute must
          include a readable copy of the attribution notices contained
          within such NOTICE file, excluding those notices that do not
          pertain to any part of the Derivative Works, in at least one
          of the following places: within a NOTICE text file distributed
          as part of the Derivative Works; within the Source form or
          documentation, if provided along with the Derivative Works; or,
          within a display generated by the Derivative Works, if and
          wherever such third-party notices normally appear. The contents
          of the NOTICE file are for informational purposes only and
          do not modify the License. You may add Your own attribution
          notices within Derivative Works that You distribute, alongside
          or as an addendum to the NOTICE text from the Work, provided
          that such additional attribution notices cannot be construed
          as modifying the License.

      You may add Your own copyright statement to Your modifications and
      may provide additional or different license terms and conditions
      for use, reproduction, or distribution of Your modifications, or
      for any such Derivative Works as a whole, provided Your use,
      reproduction, and distribution of the Work otherwise complies with
      the conditions stated in this License.

   5. Submission of Contributions. Unless You explicitly state otherwise,
      any Contribution intentionally submitted for inclusion in the Work
      by You to the Licensor shall be under the terms and conditions of
      this License, without any additional terms or conditions.
      Notwithstanding the above, nothing herein shall supersede or modify
      the terms of any separate license agreement you may have executed
      with Licensor regarding such Contributions.

   6. Trademarks. This License does not grant permission to use the trade
      names, trademarks, service marks, or product names of the Licensor,
      except as required for reasonable and customary use in describing the
      origin of the Work and reproducing the content of the NOTICE file.

   7. Disclaimer of Warranty. Unless required by applicable law or
      agreed to in writing, Licensor provides the Work (and each
      Contributor provides its Contributions) on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
      implied, including, without limitation, any warranties or conditions
      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
      PARTICULAR PURPOSE. You are solely responsible for determining the
      appropriateness of using or redistributing the Work and assume any
      risks associated with Your exercise of permissions under this License.

   8. Limitation of Liability. In no event and under no legal theory,
      whether in tort (including negligence), contract, or otherwise,
      unless required by applicable law (such as deliberate and grossly
      negligent acts) or agreed to in writing, shall any Contributor be
      liable to You for damages, including any direct, indirect, special,
      incidental, or consequential damages of any character arising as a
      result of this License or out of the use or inability to use the
      Work (including but not limited to damages for loss of goodwill,
      work stoppage, computer failure or malfunction, or any and all
      other commercial damages or losses), even if such Contributor
      has been advised of the possibility of such damages.

   9. Accepting Warranty or Additional Liability. While redistributing
      the Work or Derivative Works thereof, You may choose to offer,
      and charge a fee for, acceptance of support, warranty, indemnity,
      or other liability obligations and/or rights consistent with this
      License. However, in accepting such obligations, You may act only
      on Your own behalf and on Your sole responsibility, not on behalf
      of any other Contributor, and only if You agree to indemnify,
      defend, and hold each Contributor harmless for any liability
      incurred by, or claims asserted against, such Contributor by reason
      of your accepting any such warranty or additional liability.

   END OF TERMS AND CONDITIONS

   APPENDIX: How to apply the Apache License to your work.

      To apply the Apache License to your work, attach the following
      boilerplate notice, with the fields enclosed by brackets "[]"
      replaced with your own identifying information. (Don't include
      the brackets!)  The text should be enclosed in the appropriate
      comment syntax for the file format. We also recommend that a
      file or class name and description of purpose be included on the
      same "printed page" as the copyright notice for easier
      identification within third-party archives.

   Copyright [yyyy] [name of copyright owner]

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.


================================================
FILE: LICENSE.txt
================================================
Creative Commons Attribution 3.0 Unported
http://creativecommons.org/licenses/by/3.0/

License

THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED.

BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE MAY BE CONSIDERED TO BE A CONTRACT, THE LICENSOR GRANTS YOU THE RIGHTS CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND CONDITIONS.

1. Definitions

   1. "Adaptation" means a work based upon the Work, or upon the Work and other pre-existing works, such as a translation, adaptation, derivative work, arrangement of music or other alterations of a literary or artistic work, or phonogram or performance and includes cinematographic adaptations or any other form in which the Work may be recast, transformed, or adapted including in any form recognizably derived from the original, except that a work that constitutes a Collection will not be considered an Adaptation for the purpose of this License. For the avoidance of doubt, where the Work is a musical work, performance or phonogram, the synchronization of the Work in timed-relation with a moving image ("synching") will be considered an Adaptation for the purpose of this License.
   2. "Collection" means a collection of literary or artistic works, such as encyclopedias and anthologies, or performances, phonograms or broadcasts, or other works or subject matter other than works listed in Section 1(f) below, which, by reason of the selection and arrangement of their contents, constitute intellectual creations, in which the Work is included in its entirety in unmodified form along with one or more other contributions, each constituting separate and independent works in themselves, which together are assembled into a collective whole. A work that constitutes a Collection will not be considered an Adaptation (as defined above) for the purposes of this License.
   3. "Distribute" means to make available to the public the original and copies of the Work or Adaptation, as appropriate, through sale or other transfer of ownership.
   4. "Licensor" means the individual, individuals, entity or entities that offer(s) the Work under the terms of this License.
   5. "Original Author" means, in the case of a literary or artistic work, the individual, individuals, entity or entities who created the Work or if no individual or entity can be identified, the publisher; and in addition (i) in the case of a performance the actors, singers, musicians, dancers, and other persons who act, sing, deliver, declaim, play in, interpret or otherwise perform literary or artistic works or expressions of folklore; (ii) in the case of a phonogram the producer being the person or legal entity who first fixes the sounds of a performance or other sounds; and, (iii) in the case of broadcasts, the organization that transmits the broadcast.
   6. "Work" means the literary and/or artistic work offered under the terms of this License including without limitation any production in the literary, scientific and artistic domain, whatever may be the mode or form of its expression including digital form, such as a book, pamphlet and other writing; a lecture, address, sermon or other work of the same nature; a dramatic or dramatico-musical work; a choreographic work or entertainment in dumb show; a musical composition with or without words; a cinematographic work to which are assimilated works expressed by a process analogous to cinematography; a work of drawing, painting, architecture, sculpture, engraving or lithography; a photographic work to which are assimilated works expressed by a process analogous to photography; a work of applied art; an illustration, map, plan, sketch or three-dimensional work relative to geography, topography, architecture or science; a performance; a broadcast; a phonogram; a compilation of data to the extent it is protected as a copyrightable work; or a work performed by a variety or circus performer to the extent it is not otherwise considered a literary or artistic work.
   7. "You" means an individual or entity exercising rights under this License who has not previously violated the terms of this License with respect to the Work, or who has received express permission from the Licensor to exercise rights under this License despite a previous violation.
   8. "Publicly Perform" means to perform public recitations of the Work and to communicate to the public those public recitations, by any means or process, including by wire or wireless means or public digital performances; to make available to the public Works in such a way that members of the public may access these Works from a place and at a place individually chosen by them; to perform the Work to the public by any means or process and the communication to the public of the performances of the Work, including by public digital performance; to broadcast and rebroadcast the Work by any means including signs, sounds or images.
   9. "Reproduce" means to make copies of the Work by any means including without limitation by sound or visual recordings and the right of fixation and reproducing fixations of the Work, including storage of a protected performance or phonogram in digital form or other electronic medium.

2. Fair Dealing Rights. Nothing in this License is intended to reduce, limit, or restrict any uses free from copyright or rights arising from limitations or exceptions that are provided for in connection with the copyright protection under copyright law or other applicable laws.

3. License Grant. Subject to the terms and conditions of this License, Licensor hereby grants You a worldwide, royalty-free, non-exclusive, perpetual (for the duration of the applicable copyright) license to exercise the rights in the Work as stated below:

   1. to Reproduce the Work, to incorporate the Work into one or more Collections, and to Reproduce the Work as incorporated in the Collections;
   2. to create and Reproduce Adaptations provided that any such Adaptation, including any translation in any medium, takes reasonable steps to clearly label, demarcate or otherwise identify that changes were made to the original Work. For example, a translation could be marked "The original work was translated from English to Spanish," or a modification could indicate "The original work has been modified.";
   3. to Distribute and Publicly Perform the Work including as incorporated in Collections; and,
   4. to Distribute and Publicly Perform Adaptations.
   5.

      For the avoidance of doubt:
         1. Non-waivable Compulsory License Schemes. In those jurisdictions in which the right to collect royalties through any statutory or compulsory licensing scheme cannot be waived, the Licensor reserves the exclusive right to collect such royalties for any exercise by You of the rights granted under this License;
         2. Waivable Compulsory License Schemes. In those jurisdictions in which the right to collect royalties through any statutory or compulsory licensing scheme can be waived, the Licensor waives the exclusive right to collect such royalties for any exercise by You of the rights granted under this License; and,
         3. Voluntary License Schemes. The Licensor waives the right to collect royalties, whether individually or, in the event that the Licensor is a member of a collecting society that administers voluntary licensing schemes, via that society, from any exercise by You of the rights granted under this License.

The above rights may be exercised in all media and formats whether now known or hereafter devised. The above rights include the right to make such modifications as are technically necessary to exercise the rights in other media and formats. Subject to Section 8(f), all rights not expressly granted by Licensor are hereby reserved.

4. Restrictions. The license granted in Section 3 above is expressly made subject to and limited by the following restrictions:

   1. You may Distribute or Publicly Perform the Work only under the terms of this License. You must include a copy of, or the Uniform Resource Identifier (URI) for, this License with every copy of the Work You Distribute or Publicly Perform. You may not offer or impose any terms on the Work that restrict the terms of this License or the ability of the recipient of the Work to exercise the rights granted to that recipient under the terms of the License. You may not sublicense the Work. You must keep intact all notices that refer to this License and to the disclaimer of warranties with every copy of the Work You Distribute or Publicly Perform. When You Distribute or Publicly Perform the Work, You may not impose any effective technological measures on the Work that restrict the ability of a recipient of the Work from You to exercise the rights granted to that recipient under the terms of the License. This Section 4(a) applies to the Work as incorporated in a Collection, but this does not require the Collection apart from the Work itself to be made subject to the terms of this License. If You create a Collection, upon notice from any Licensor You must, to the extent practicable, remove from the Collection any credit as required by Section 4(b), as requested. If You create an Adaptation, upon notice from any Licensor You must, to the extent practicable, remove from the Adaptation any credit as required by Section 4(b), as requested.
   2. If You Distribute, or Publicly Perform the Work or any Adaptations or Collections, You must, unless a request has been made pursuant to Section 4(a), keep intact all copyright notices for the Work and provide, reasonable to the medium or means You are utilizing: (i) the name of the Original Author (or pseudonym, if applicable) if supplied, and/or if the Original Author and/or Licensor designate another party or parties (e.g., a sponsor institute, publishing entity, journal) for attribution ("Attribution Parties") in Licensor's copyright notice, terms of service or by other reasonable means, the name of such party or parties; (ii) the title of the Work if supplied; (iii) to the extent reasonably practicable, the URI, if any, that Licensor specifies to be associated with the Work, unless such URI does not refer to the copyright notice or licensing information for the Work; and (iv) , consistent with Section 3(b), in the case of an Adaptation, a credit identifying the use of the Work in the Adaptation (e.g., "French translation of the Work by Original Author," or "Screenplay based on original Work by Original Author"). The credit required by this Section 4 (b) may be implemented in any reasonable manner; provided, however, that in the case of a Adaptation or Collection, at a minimum such credit will appear, if a credit for all contributing authors of the Adaptation or Collection appears, then as part of these credits and in a manner at least as prominent as the credits for the other contributing authors. For the avoidance of doubt, You may only use the credit required by this Section for the purpose of attribution in the manner set out above and, by exercising Your rights under this License, You may not implicitly or explicitly assert or imply any connection with, sponsorship or endorsement by the Original Author, Licensor and/or Attribution Parties, as appropriate, of You or Your use of the Work, without the separate, express prior written permission of the Original Author, Licensor and/or Attribution Parties.
   3. Except as otherwise agreed in writing by the Licensor or as may be otherwise permitted by applicable law, if You Reproduce, Distribute or Publicly Perform the Work either by itself or as part of any Adaptations or Collections, You must not distort, mutilate, modify or take other derogatory action in relation to the Work which would be prejudicial to the Original Author's honor or reputation. Licensor agrees that in those jurisdictions (e.g. Japan), in which any exercise of the right granted in Section 3(b) of this License (the right to make Adaptations) would be deemed to be a distortion, mutilation, modification or other derogatory action prejudicial to the Original Author's honor and reputation, the Licensor will waive or not assert, as appropriate, this Section, to the fullest extent permitted by the applicable national law, to enable You to reasonably exercise Your right under Section 3(b) of this License (right to make Adaptations) but not otherwise.

5. Representations, Warranties and Disclaimer

UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING, LICENSOR OFFERS THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, INCLUDING, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTIBILITY, FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OF ABSENCE OF ERRORS, WHETHER OR NOT DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES, SO SUCH EXCLUSION MAY NOT APPLY TO YOU.

6. Limitation on Liability. EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE LAW, IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

7. Termination

   1. This License and the rights granted hereunder will terminate automatically upon any breach by You of the terms of this License. Individuals or entities who have received Adaptations or Collections from You under this License, however, will not have their licenses terminated provided such individuals or entities remain in full compliance with those licenses. Sections 1, 2, 5, 6, 7, and 8 will survive any termination of this License.
   2. Subject to the above terms and conditions, the license granted here is perpetual (for the duration of the applicable copyright in the Work). Notwithstanding the above, Licensor reserves the right to release the Work under different license terms or to stop distributing the Work at any time; provided, however that any such election will not serve to withdraw this License (or any other license that has been, or is required to be, granted under the terms of this License), and this License will continue in full force and effect unless terminated as stated above.

8. Miscellaneous

   1. Each time You Distribute or Publicly Perform the Work or a Collection, the Licensor offers to the recipient a license to the Work on the same terms and conditions as the license granted to You under this License.
   2. Each time You Distribute or Publicly Perform an Adaptation, Licensor offers to the recipient a license to the original Work on the same terms and conditions as the license granted to You under this License.
   3. If any provision of this License is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this License, and without further action by the parties to this agreement, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
   4. No term or provision of this License shall be deemed waived and no breach consented to unless such waiver or consent shall be in writing and signed by the party to be charged with such waiver or consent.
   5. This License constitutes the entire agreement between the parties with respect to the Work licensed here. There are no understandings, agreements or representations with respect to the Work not specified here. Licensor shall not be bound by any additional provisions that may appear in any communication from You. This License may not be modified without the mutual written agreement of the Licensor and You.
   6. The rights granted under, and the subject matter referenced, in this License were drafted utilizing the terminology of the Berne Convention for the Protection of Literary and Artistic Works (as amended on September 28, 1979), the Rome Convention of 1961, the WIPO Copyright Treaty of 1996, the WIPO Performances and Phonograms Treaty of 1996 and the Universal Copyright Convention (as revised on July 24, 1971). These rights and subject matter take effect in the relevant jurisdiction in which the License terms are sought to be enforced according to the corresponding provisions of the implementation of those treaty provisions in the applicable national law. If the standard suite of rights granted under applicable copyright law includes additional rights not granted under this License, such additional rights are deemed to be included in the License; this License is not intended to restrict the license of any rights under applicable law.


================================================
FILE: README.md
================================================
# aws-pod

GitPod workspace for AWS

https://gitpod.io/#https://github.com/CaravanaCloud/aws-pod


================================================
FILE: labs/ami-multiverse/README.md
================================================
# Install SDKMan
```
curl -s "https://get.sdkman.io" | bash
source "/home/ec2-user/.sdkman/bin/sdkman-init.sh"
```

# Install Java
```
sdk list java
sdk install java 22.0.0.2.r17-grl
```

# Install Multiverse Application
```
mkdir demo-multiverse
cd demo-multiverse
URL=https://github.com/CaravanaCloud/aws-pod/releases/download/v1.0.20220723105446/demo-multiverse-1.0.0-SNAPSHOT-runner.jar
OUT=demo-multiverse-1.0.0-SNAPSHOT-runner.jar
curl -Ls $URL --output $OUT
```

Add database configuration to .env
```
QUARKUS_DATASOURCE_DB_KIND=mysql
QUARKUS_DATASOURCE_USERNAME=appuser
QUARKUS_DATASOURCE_PASSWORD=Masterkey123
QUARKUS_DATASOURCE_JDBC_URL=jdbc:mysql://rdshost:5432/appdb
```

Add to/etc/rc.d/rc.local:
```
cd /home/ec2-user/demo-multiverse/
sudo -u ec2-user bash -c '/home/ec2-user/.sdkman/candidates/java/current/bin/java -jar /home/ec2-user/demo-multiverse/demo-multiverse-1.0.0-SNAPSHOT-runner.jar'
```

Make it executable 
```
chmod +x /etc/rc.d/rc.local
```

Restart the instance:
```
sudo reboot
```

Verify
```
curl -s "http://$(curl -s http://instance-data/latest/meta-data/public-ipv4):8080"
```

Your instance is ready to take an AMI


================================================
FILE: labs/vpc-debug/tf/main.tf
================================================
# aws sts get-caller-identity
# cd labs/vpc-debug/tf/
# terraform init
# terraform apply -auto-approve
# terraform destroy -auto-approve

# NO SPOILERS ;)
 
terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 4.0"
    }
  }
}

# Configure the AWS Provider
provider "aws" {
  region = "us-west-2"
}


variable "domain_name" {
  type    = string
  default = "hashcorp.cloud"
}

variable "username" {
  type    = string
  default = "gohorse"
}

variable "az1" {
  type    = string
  default = "us-west-2a"
}

variable "az2" {
  type    = string
  default = "us-west-2b"
}

data "aws_caller_identity" "current" {}

data "aws_iam_policy" "ssm-policy" {
  arn = "arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore"
}

# Create the role
resource "aws_iam_role" "instance-role" {
  assume_role_policy = jsonencode({
    Version = "2012-10-17"
    Statement = [
      {
        Action = "sts:AssumeRole"
        Effect = "Allow"
        Sid    = ""
        Principal = {
          Service = "ec2.amazonaws.com"
        }
      },
    ]
  })
}

# Attach the policy to the role
resource "aws_iam_role_policy_attachment" "attach-s3" {
  role       = aws_iam_role.instance-role.name
  policy_arn = data.aws_iam_policy.ssm-policy.arn
}

resource "aws_iam_instance_profile" "ssm-profile" {
  name = "ssm-profile"
  role = aws_iam_role.instance-role.name
}

# Create a VPC
resource "aws_vpc" "lab_vpc" {
  cidr_block = "10.0.0.0/16"
  enable_dns_support = true
  enable_dns_hostnames = true
}

resource "aws_internet_gateway" "gw" {
  vpc_id = aws_vpc.lab_vpc.id
}

# Healthy side
resource "aws_route_table" "routes1" {
  vpc_id = aws_vpc.lab_vpc.id

  route {
    cidr_block = "0.0.0.0/0"
    gateway_id = aws_internet_gateway.gw.id
  }
}

resource "aws_subnet" "pub1" {
  vpc_id     = aws_vpc.lab_vpc.id
  cidr_block = "10.0.1.0/24"
  map_public_ip_on_launch = true
  availability_zone = var.az1
}

resource "aws_route_table_association" "pub1routes1" {
  subnet_id      = aws_subnet.pub1.id
  route_table_id = aws_route_table.routes1.id
}

resource "aws_security_group" "sg1" {
  name        = "lab-sg1"
  description = "lab-sg1"
  vpc_id      = aws_vpc.lab_vpc.id

  ingress {
    description      = "Allow 80"
    from_port        = 80
    to_port          = 80
    protocol         = "tcp"
    cidr_blocks      = ["0.0.0.0/0"]
  }

  ingress {
    description      = "Allow 22"
    from_port        = 22
    to_port          = 22
    protocol         = "tcp"
    cidr_blocks      = ["0.0.0.0/0"]
  }

  egress {
    from_port        = 0
    to_port          = 0
    protocol         = "-1"
    cidr_blocks      = ["0.0.0.0/0"]
    ipv6_cidr_blocks = ["::/0"]
  }
}

resource "aws_instance" "web2048-ok" {
  ami           = "ami-a0cfeed8"
  instance_type = "t3.micro"
  iam_instance_profile = aws_iam_instance_profile.ssm-profile.name
  vpc_security_group_ids = [aws_security_group.sg1.id]
  subnet_id = aws_subnet.pub1.id

  tags = {
    Name = "lab-web2048-ok"
  }

  user_data = <<EOF
#!/bin/bash
yum -y install docker
service docker start
usermod -a -G docker ec2-user
docker run -d --rm -p80:80 alexwhen/docker-2048
echo "user data done"
EOF
}

# Unhealthy Side
resource "aws_route_table" "routes2" {
  vpc_id = aws_vpc.lab_vpc.id

# BUG: No route to gateway
#  route {
#    cidr_block = "0.0.0.0/24"
#    gateway_id = aws_internet_gateway.gw.id
#  }
}

resource "aws_subnet" "pub2" {
  vpc_id     = aws_vpc.lab_vpc.id
  cidr_block = "10.0.2.0/24"
  availability_zone = var.az2 
  #BUG: missing  map_public_ip_on_launch = true
}

resource "aws_route_table_association" "pub2routes2" {
  subnet_id      = aws_subnet.pub2.id
  route_table_id = aws_route_table.routes2.id
}

resource "aws_security_group" "sg2" {
  name        = "lab-sg2"
  description = "lab-sg2"
  vpc_id      = aws_vpc.lab_vpc.id

# BUG: No ingress
#  ingress {
#    description      = "Allow 80"
#    from_port        = 80
#    to_port          = 80
#    protocol         = "tcp"
#    cidr_blocks      = ["0.0.0.0/0"]
#  }

  ingress {
    description      = "Allow 22"
    from_port        = 22
    to_port          = 22
    protocol         = "tcp"
    cidr_blocks      = ["0.0.0.0/0"]
  }


# BUG: No egress allow
#  egress {
#    from_port        = 0
#    to_port          = 0
#    protocol         = "-1"
#    cidr_blocks      = ["0.0.0.0/0"]
#    ipv6_cidr_blocks = ["::/0"]
#  }

}

resource "aws_instance" "web2048-error" {
  ami           = "ami-a0cfeed8"
  instance_type = "t3.micro"
  vpc_security_group_ids = [aws_security_group.sg2.id]
  subnet_id = aws_subnet.pub2.id

  tags = {
    Name = "lab-web2048-error"
  }

  user_data = <<EOF
#!/bin/bash
yum -y install docker
service docker start
usermod -a -G docker ec2-user
docker run -d --rm -p80:80 alexwhen/docker-2048
echo "user data done"
EOF
}


resource "aws_security_group" "sglb" {
  name        = "lab-sglb"
  description = "lab-sglb"
  vpc_id      = aws_vpc.lab_vpc.id

  ingress {
    description      = "Allow 80"
    from_port        = 80
    to_port          = 80
    protocol         = "tcp"
    cidr_blocks      = ["0.0.0.0/0"]
  }

  egress {
    from_port        = 0
    to_port          = 0
    protocol         = "-1"
    cidr_blocks      = ["0.0.0.0/0"]
    ipv6_cidr_blocks = ["::/0"]
  }
}

resource "aws_lb_target_group" "tg" {
  name     = "lab-tg"
  port     = 80
  protocol = "HTTP"
  vpc_id   = aws_vpc.lab_vpc.id 
  target_type  = "instance"
}

resource "aws_lb" "lb" {
  name               = "lab-lb"
  internal           = false
  load_balancer_type = "application"
  security_groups    = [aws_security_group.sglb.id]
  subnets            = [aws_subnet.pub1.id, aws_subnet.pub2.id]
}

resource "aws_lb_listener" "lb_listener_http" {
   load_balancer_arn    = aws_lb.lb.id
   port                 = "80"
   protocol             = "HTTP"
   default_action {
    target_group_arn = aws_lb_target_group.tg.id
    type             = "forward"
  }
}

resource "aws_lb_target_group_attachment" "attach1" {
 target_group_arn = aws_lb_target_group.tg.arn
 target_id        = aws_instance.web2048-ok.id

#  port             = 80
}

resource "aws_lb_target_group_attachment" "attach2" {
  target_group_arn = aws_lb_target_group.tg.arn
  target_id        = aws_instance.web2048-error.id
#  port             = 80
}

resource "aws_vpc" "main" {
  cidr_block = "10.0.0.0/16"
}

resource "aws_iam_user" "user" {
  name = var.username
}

resource "aws_iam_user_policy_attachment" "grantpoweruser" {
  user       = aws_iam_user.user.name
  policy_arn = "arn:aws:iam::aws:policy/PowerUserAccess"
}

resource "aws_iam_access_key" "keys" {
  user = aws_iam_user.user.name
}

output "ak" {
  value = aws_iam_access_key.keys.id
}

output "lb_dns" {
  value = aws_lb.lb.dns_name
}

#output "sk" {
#  value = aws_iam_access_key.keys.secret
#}

output "acct_id" {
  value = data.aws_caller_identity.current.account_id
}


================================================
FILE: scripts/git-push-all.sh
================================================
#/bin/bash

git commit --allow-empty -am "WIP at $(date +%Y%m%d-%H%M%S)"
git push


================================================
FILE: scripts/git-release.sh
================================================
#/bin/bash

MAJOR=1
MINOR=0
PATCH=$(date +%Y%m%d%H%M%S)
VERSION="$MAJOR.$MINOR.$PATCH"
TAG="v$VERSION"
NOTES=${NOTES:-"AWS pod release $VERSION"}
git tag $TAG -m "$NOTES"
git push origin $TAG


================================================
FILE: scripts/instance-policy.json
================================================
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": "*",
            "Resource": "*"
        }
    ]
}


================================================
FILE: scripts/instance-trust.json
================================================
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Principal": {
                "Service": "ec2.amazonaws.com"
            },
            "Action": "sts:AssumeRole"
        }
    ]
}

================================================
FILE: snippets/aws-cli-demo.sh
================================================
aws sts get-caller-identity

aws configure 

aws configure --profile myteam
export AWS_PROFILE="myteam"

aws ec2 describe-availability-zones

aws ec2 describe-availability-zones \
    --output "text"

aws ec2 describe-availability-zones \
    --query "AvailabilityZones[].ZoneName"

VPC_ID=$(aws ec2 create-vpc \
    --cidr-block "10.0.0.0/16" \
    --query "Vpc.VpcId" \
    --output text)

aws ec2 wait vpc-available \
    --vpc-ids="$VPC_ID" \
    && echo "$VPC_ID is available"



================================================
FILE: snippets/cloudformation/hello-bucket.template.yaml
================================================
# aws cloudformation create-stack --stack-name "bucket-$RANDOM" --template-body file://hello-bucket.template.yaml
Resources:
  S3Bucket:
    Type: 'AWS::S3::Bucket'


================================================
FILE: snippets/cloudformation/sample-bucket.template.yaml
================================================
# aws cloudformation create-stack --stack-name "bucket-$RANDOM" --template-body file://sample-bucket.template.yaml
AWSTemplateFormatVersion: "2010-09-09"
Description: A sample S3 bucket
Resources:
  S3Bucket:
    Type: 'AWS::S3::Bucket'
Outputs:
  BucketName:
    Value: !Ref S3Bucket
    Description: The name of the S3 bucket
  BucketARN:
    Value: !GetAtt S3Bucket.Arn
    Description: The ARN of the S3 bucket

================================================
FILE: snippets/cloudformation/sample-codebuild.template.yaml
================================================
# aws cloudformation create-stack --stack-name "build-$RANDOM" --template-body file://sample-codebuild.template.yaml --capabilities CAPABILITY_IAM
# aws cloudformation deploy --stack-name "build-$RANDOM" --template-file sample-codebuild.template.yaml --capabilities CAPABILITY_IAM
Description: CodeBuild project for aws-pod

Parameters:
  EnvName:
    Description: An environment name that is prefixed to resource names
    Type: String
    Default: devenv

Resources:
  ArtifactsBucket:
    Type: 'AWS::S3::Bucket'
  CodeBuildProject:
    Type: AWS::CodeBuild::Project
    Properties:
      ServiceRole: !GetAtt CodeBuildRole.Arn
      Artifacts:
        Type: NO_ARTIFACTS
      Environment:
        Type: LINUX_CONTAINER
        ComputeType: BUILD_GENERAL1_SMALL
        Image: "aws/codebuild/amazonlinux2-x86_64-standard:4.0"
        EnvironmentVariables:
          - Name: QUARKUS_PROFILE
            Value: prod
            Type: PLAINTEXT
          - Name: ARTIFACTS_S3_BUCKET
            Value: !Ref ArtifactsBucket
            Type: PLAINTEXT
      Source:
        Type: GITHUB
        Location: "https://github.com/CaravanaCloud/aws-pod"
      TimeoutInMinutes: 15
      VpcConfig:
        VpcId:
          Fn::ImportValue:
            !Sub "${EnvName}::VPCID"
        Subnets:
          - Fn::ImportValue:
              !Sub "${EnvName}::PVTNET1"
          - Fn::ImportValue:
              !Sub "${EnvName}::PVTNET2"
        SecurityGroupIds: [!Ref CodeBuildSecurityGroup]
      Cache:
        Type: S3
        Location: !Sub "${ArtifactsBucket}/cache"
  CodeBuildRole:
    Type: AWS::IAM::Role
    Properties:
      AssumeRolePolicyDocument:
        Statement:
        - Action: ['sts:AssumeRole']
          Effect: Allow
          Principal:
            Service: [codebuild.amazonaws.com]
        Version: '2012-10-17'
      Path: /
      Policies:
        - PolicyName: CodeBuildAccess
          PolicyDocument:
            Version: '2012-10-17'
            Statement:
              - Action:
                - 'logs:*'
                - 'ec2:CreateNetworkInterface'
                - 'ec2:DescribeNetworkInterfaces'
                - 'ec2:DeleteNetworkInterface'
                - 'ec2:DescribeSubnets'
                - 'ec2:DescribeSecurityGroups'
                - 'ec2:DescribeDhcpOptions'
                - 'ec2:DescribeVpcs'
                - 'ec2:CreateNetworkInterfacePermission'
                Effect: Allow
                Resource: '*'
  CodeBuildVPC:
    Type: AWS::EC2::VPC
    Properties:
      CidrBlock: 10.0.0.0/16
      EnableDnsSupport: 'true'
      EnableDnsHostnames: 'true'
      Tags:
        - Key: name
          Value: codebuild
  CodeBuildSubnet:
    Type: AWS::EC2::Subnet
    Properties:
      VpcId:
        Ref: CodeBuildVPC
      CidrBlock: 10.0.1.0/24
  CodeBuildSecurityGroup:
    Type: AWS::EC2::SecurityGroup
    Properties:
      GroupName: Codebuild Internet Group
      GroupDescription: 'CodeBuild SecurityGroup'
      VpcId: 
        Fn::ImportValue:
          !Sub "${EnvName}::VPCID"

Outputs:
  CodeBuildProjectRef:
    Description: Code Build Project
    Value: !Ref CodeBuildProject

================================================
FILE: snippets/cloudformation/sample-database.template.yaml
================================================
# aws cloudformation create-stack --stack-name "database-$RANDOM" --template-body file://sample-database.template.yaml
Description: Database sample template

Parameters:
  EnvName:
    Type: String
    Default: "devenv"
  MasterUsername:
    Type: String
    Default: "root"
  MasterUserPassword:
    Type: String
    Default: "Masterkey123"
  DBInstanceClass:
    Type: String
    Default: "db.t3.small" 

Resources:
  DatabaseSecurityGroup:
    Type: AWS::EC2::SecurityGroup
    Properties:
      GroupDescription: "Security Group for Database"
      VpcId:
        Fn::ImportValue:
          !Sub "${EnvName}::VPCID"
      Tags:
        - Key: Name
          Value: !Sub '${AWS::StackName}/DatabaseSecurityGroup'

  DatabaseIngress:
    Type: 'AWS::EC2::SecurityGroupIngress'
    Properties:
      GroupId: !Ref 'DatabaseSecurityGroup'
      IpProtocol: 'tcp'
      FromPort: '3306'
      ToPort: '3306'
      SourceSecurityGroupId: !GetAtt 'DatabaseSecurityGroup.GroupId'

  DatabaseSubnetGroup:
    Type: AWS::RDS::DBSubnetGroup
    Properties:
      DBSubnetGroupDescription: Subnet Group for RDS
      SubnetIds:
        - Fn::ImportValue:
            !Sub "${EnvName}::PUBNET0"
        - Fn::ImportValue:
            !Sub "${EnvName}::PUBNET1"
        - Fn::ImportValue:
            !Sub "${EnvName}::PUBNET2"

  DatabaseCluster:
    Type: AWS::RDS::DBCluster
    Properties:
      Engine: aurora
      MasterUsername: !Ref "MasterUsername"
      MasterUserPassword: !Ref "MasterUserPassword"
      DBSubnetGroupName: !Ref "DatabaseSubnetGroup"
      VpcSecurityGroupIds:
        - !Ref "DatabaseSecurityGroup"

  DatabasePrimaryInstance:
    Type: AWS::RDS::DBInstance
    Properties:
      Engine: aurora
      DBClusterIdentifier: !Ref "DatabaseCluster"
      DBInstanceClass: !Ref "DBInstanceClass"
      DBSubnetGroupName: !Ref "DatabaseSubnetGroup"

Outputs:
  DatabaseClusterId:
    Description: DatabaseClusterId
    Value: !Ref DatabaseCluster
    Export:
      Name: !Sub "${EnvName}::DBID"

================================================
FILE: snippets/cloudformation/sample-instance.template.yaml
================================================
# aws cloudformation create-stack --stack-name "instance-$RANDOM" --template-body file://sample-instance.template

AWSTemplateFormatVersion: 2010-09-09
Description: Sample instance template with wordpress and cfn-init features
Parameters:
  EnvName:
    Type: String
    Default: "devenv"
  InstanceType:
    Description: WebServer EC2 instance type
    Type: String
    Default: t2.micro
    AllowedValues:
      - t1.micro
      - t2.nano
      - t2.micro
      - t2.small
      - t2.medium
      - t2.large
      - t3.micro
      - t3.small
      - t3.medium
      - t3.large
      - t3.xlarge
      - t3.2xlarge
      - m1.small
      - m1.medium
      - m1.large
      - m1.xlarge
      - m2.xlarge
      - m2.2xlarge
      - m2.4xlarge
      - m3.medium
      - m3.large
      - m3.xlarge
      - m3.2xlarge
      - m4.large
      - m4.xlarge
      - m4.2xlarge
      - m4.4xlarge
      - m4.10xlarge
      - c1.medium
      - c1.xlarge
      - c3.large
      - c3.xlarge
      - c3.2xlarge
      - c3.4xlarge
      - c3.8xlarge
      - c4.large
      - c4.xlarge
      - c4.2xlarge
      - c4.4xlarge
      - c4.8xlarge
      - g2.2xlarge
      - g2.8xlarge
      - r3.large
      - r3.xlarge
      - r3.2xlarge
      - r3.4xlarge
      - r3.8xlarge
      - i2.xlarge
      - i2.2xlarge
      - i2.4xlarge
      - i2.8xlarge
      - d2.xlarge
      - d2.2xlarge
      - d2.4xlarge
      - d2.8xlarge
      - hi1.4xlarge
      - hs1.8xlarge
      - cr1.8xlarge
      - cc2.8xlarge
      - cg1.4xlarge
    ConstraintDescription: must be a valid EC2 instance type.
  SSHLocation:
    Description: The IP address range that can be used to SSH to the EC2 instances
    Type: String
    MinLength: '9'
    MaxLength: '18'
    Default: 0.0.0.0/0
    AllowedPattern: '(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/(\d{1,2})'
    ConstraintDescription: must be a valid IP CIDR range of the form x.x.x.x/x.
  DBName:
    Default: wordpressdb
    Description: The WordPress database name
    Type: String
    MinLength: '1'
    MaxLength: '64'
    AllowedPattern: '[a-zA-Z][a-zA-Z0-9]*'
    ConstraintDescription: must begin with a letter and contain only alphanumeric characters.
  DBUser:
    NoEcho: 'true'
    Description: The WordPress database admin account username
    Type: String
    MinLength: '1'
    MaxLength: '16'
    AllowedPattern: '[a-zA-Z][a-zA-Z0-9]*'
    ConstraintDescription: must begin with a letter and contain only alphanumeric characters.
    Default: 'wpuser'
  DBPassword:
    NoEcho: 'true'
    Description: The WordPress database admin account password
    Type: String
    MinLength: '8'
    MaxLength: '41'
    AllowedPattern: '[a-zA-Z0-9]*'
    ConstraintDescription: must contain only alphanumeric characters.
    Default: 'Masterkey321'
  DBRootPassword:
    NoEcho: 'true'
    Description: MySQL root password
    Type: String
    MinLength: '8'
    MaxLength: '41'
    AllowedPattern: '[a-zA-Z0-9]*'
    ConstraintDescription: must contain only alphanumeric characters.
    Default: 'Masterkey123'

Mappings:
  AWSInstanceType2Arch:
    t1.micro:
      Arch: HVM64
    t2.nano:
      Arch: HVM64
    t2.micro:
      Arch: HVM64
    t2.small:
      Arch: HVM64
    t2.medium:
      Arch: HVM64
    t2.large:
      Arch: HVM64
    m1.small:
      Arch: HVM64
    m1.medium:
      Arch: HVM64
    m1.large:
      Arch: HVM64
    m1.xlarge:
      Arch: HVM64
    m2.xlarge:
      Arch: HVM64
    m2.2xlarge:
      Arch: HVM64
    m2.4xlarge:
      Arch: HVM64
    m3.medium:
      Arch: HVM64
    m3.large:
      Arch: HVM64
    m3.xlarge:
      Arch: HVM64
    m3.2xlarge:
      Arch: HVM64
    m4.large:
      Arch: HVM64
    m4.xlarge:
      Arch: HVM64
    m4.2xlarge:
      Arch: HVM64
    m4.4xlarge:
      Arch: HVM64
    m4.10xlarge:
      Arch: HVM64
    c1.medium:
      Arch: HVM64
    c1.xlarge:
      Arch: HVM64
    c3.large:
      Arch: HVM64
    c3.xlarge:
      Arch: HVM64
    c3.2xlarge:
      Arch: HVM64
    c3.4xlarge:
      Arch: HVM64
    c3.8xlarge:
      Arch: HVM64
    c4.large:
      Arch: HVM64
    c4.xlarge:
      Arch: HVM64
    c4.2xlarge:
      Arch: HVM64
    c4.4xlarge:
      Arch: HVM64
    c4.8xlarge:
      Arch: HVM64
    g2.2xlarge:
      Arch: HVMG2
    g2.8xlarge:
      Arch: HVMG2
    r3.large:
      Arch: HVM64
    r3.xlarge:
      Arch: HVM64
    r3.2xlarge:
      Arch: HVM64
    r3.4xlarge:
      Arch: HVM64
    r3.8xlarge:
      Arch: HVM64
    i2.xlarge:
      Arch: HVM64
    i2.2xlarge:
      Arch: HVM64
    i2.4xlarge:
      Arch: HVM64
    i2.8xlarge:
      Arch: HVM64
    d2.xlarge:
      Arch: HVM64
    d2.2xlarge:
      Arch: HVM64
    d2.4xlarge:
      Arch: HVM64
    d2.8xlarge:
      Arch: HVM64
    hi1.4xlarge:
      Arch: HVM64
    hs1.8xlarge:
      Arch: HVM64
    cr1.8xlarge:
      Arch: HVM64
    cc2.8xlarge:
      Arch: HVM64

  AWSInstanceType2NATArch:
    t1.micro:
      Arch: NATHVM64
    t2.nano:
      Arch: NATHVM64
    t2.micro:
      Arch: NATHVM64
    t2.small:
      Arch: NATHVM64
    t2.medium:
      Arch: NATHVM64
    t2.large:
      Arch: NATHVM64
    m1.small:
      Arch: NATHVM64
    m1.medium:
      Arch: NATHVM64
    m1.large:
      Arch: NATHVM64
    m1.xlarge:
      Arch: NATHVM64
    m2.xlarge:
      Arch: NATHVM64
    m2.2xlarge:
      Arch: NATHVM64
    m2.4xlarge:
      Arch: NATHVM64
    m3.medium:
      Arch: NATHVM64
    m3.large:
      Arch: NATHVM64
    m3.xlarge:
      Arch: NATHVM64
    m3.2xlarge:
      Arch: NATHVM64
    m4.large:
      Arch: NATHVM64
    m4.xlarge:
      Arch: NATHVM64
    m4.2xlarge:
      Arch: NATHVM64
    m4.4xlarge:
      Arch: NATHVM64
    m4.10xlarge:
      Arch: NATHVM64
    c1.medium:
      Arch: NATHVM64
    c1.xlarge:
      Arch: NATHVM64
    c3.large:
      Arch: NATHVM64
    c3.xlarge:
      Arch: NATHVM64
    c3.2xlarge:
      Arch: NATHVM64
    c3.4xlarge:
      Arch: NATHVM64
    c3.8xlarge:
      Arch: NATHVM64
    c4.large:
      Arch: NATHVM64
    c4.xlarge:
      Arch: NATHVM64
    c4.2xlarge:
      Arch: NATHVM64
    c4.4xlarge:
      Arch: NATHVM64
    c4.8xlarge:
      Arch: NATHVM64
    g2.2xlarge:
      Arch: NATHVMG2
    g2.8xlarge:
      Arch: NATHVMG2
    r3.large:
      Arch: NATHVM64
    r3.xlarge:
      Arch: NATHVM64
    r3.2xlarge:
      Arch: NATHVM64
    r3.4xlarge:
      Arch: NATHVM64
    r3.8xlarge:
      Arch: NATHVM64
    i2.xlarge:
      Arch: NATHVM64
    i2.2xlarge:
      Arch: NATHVM64
    i2.4xlarge:
      Arch: NATHVM64
    i2.8xlarge:
      Arch: NATHVM64
    d2.xlarge:
      Arch: NATHVM64
    d2.2xlarge:
      Arch: NATHVM64
    d2.4xlarge:
      Arch: NATHVM64
    d2.8xlarge:
      Arch: NATHVM64
    hi1.4xlarge:
      Arch: NATHVM64
    hs1.8xlarge:
      Arch: NATHVM64
    cr1.8xlarge:
      Arch: NATHVM64
    cc2.8xlarge:
      Arch: NATHVM64

  AWSRegionArch2AMI:
    af-south-1:
      HVM64: ami-064cc455f8a1ef504
      HVMG2: NOT_SUPPORTED
    ap-east-1:
      HVM64: ami-f85b1989
      HVMG2: NOT_SUPPORTED
    ap-northeast-1:
      HVM64: ami-0b2c2a754d5b4da22
      HVMG2: ami-09d0e0e099ecabba2
    ap-northeast-2:
      HVM64: ami-0493ab99920f410fc
      HVMG2: NOT_SUPPORTED
    ap-northeast-3:
      HVM64: ami-01344f6f63a4decc1
      HVMG2: NOT_SUPPORTED
    ap-south-1:
      HVM64: ami-03cfb5e1fb4fac428
      HVMG2: ami-0244c1d42815af84a
    ap-southeast-1:
      HVM64: ami-0ba35dc9caf73d1c7
      HVMG2: ami-0e46ce0d6a87dc979
    ap-southeast-2:
      HVM64: ami-0ae99b503e8694028
      HVMG2: ami-0c0ab057a101d8ff2
    ca-central-1:
      HVM64: ami-0803e21a2ec22f953
      HVMG2: NOT_SUPPORTED
    cn-north-1:
      HVM64: ami-07a3f215cc90c889c
      HVMG2: NOT_SUPPORTED
    cn-northwest-1:
      HVM64: ami-0a3b3b10f714a0ff4
      HVMG2: NOT_SUPPORTED
    eu-central-1:
      HVM64: ami-0474863011a7d1541
      HVMG2: ami-0aa1822e3eb913a11
    eu-north-1:
      HVM64: ami-0de4b8910494dba0f
      HVMG2: ami-32d55b4c
    eu-south-1:
      HVM64: ami-08427144fe9ebdef6
      HVMG2: NOT_SUPPORTED
    eu-west-1:
      HVM64: ami-015232c01a82b847b
      HVMG2: ami-0d5299b1c6112c3c7
    eu-west-2:
      HVM64: ami-0765d48d7e15beb93
      HVMG2: NOT_SUPPORTED
    eu-west-3:
      HVM64: ami-0caf07637eda19d9c
      HVMG2: NOT_SUPPORTED
    me-south-1:
      HVM64: ami-0744743d80915b497
      HVMG2: NOT_SUPPORTED
    sa-east-1:
      HVM64: ami-0a52e8a6018e92bb0
      HVMG2: NOT_SUPPORTED
    us-east-1:
      HVM64: ami-032930428bf1abbff
      HVMG2: ami-0aeb704d503081ea6
    us-east-2:
      HVM64: ami-027cab9a7bf0155df
      HVMG2: NOT_SUPPORTED
    us-west-1:
      HVM64: ami-088c153f74339f34c
      HVMG2: ami-0a7fc72dc0e51aa77
    us-west-2:
      HVM64: ami-01fee56b22f308154
      HVMG2: ami-0fe84a5b4563d8f27

Resources:
  WebServerSecurityGroup:
    Type: 'AWS::EC2::SecurityGroup'
    Properties:
      GroupDescription: >-
        Enable HTTP access via port 80 locked down to the load balancer + SSH
        access
      VpcId:
        Fn::ImportValue:
          !Sub "${EnvName}::VPCID"
      SecurityGroupIngress:
        - IpProtocol: tcp
          FromPort: '80'
          ToPort: '80'
          CidrIp: 0.0.0.0/0
        - IpProtocol: tcp
          FromPort: '22'
          ToPort: '22'
          CidrIp: !Ref SSHLocation

  WebServer:
    Type: 'AWS::EC2::Instance'
    Metadata:
      'AWS::CloudFormation::Init':
        configSets:
          wordpress_install:
            - install_cfn
            - install_wordpress
            - configure_wordpress
        install_cfn:
          files:
            /etc/cfn/cfn-hup.conf:
              content: !Join
                - ''
                - - |
                    [main]
                  - stack=
                  - !Ref 'AWS::StackId'
                  - |+

                  - region=
                  - !Ref 'AWS::Region'
                  - |+

              mode: '000400'
              owner: root
              group: root
            /etc/cfn/hooks.d/cfn-auto-reloader.conf:
              content: !Join
                - ''
                - - |
                    [cfn-auto-reloader-hook]
                  - |
                    triggers=post.update
                  - |
                    path=Resources.WebServer.Metadata.AWS::CloudFormation::Init
                  - 'action=/opt/aws/bin/cfn-init -v '
                  - '         --stack '
                  - !Ref 'AWS::StackName'
                  - '         --resource WebServer '
                  - '         --configsets wordpress_install '
                  - '         --region '
                  - !Ref 'AWS::Region'
                  - |+

              mode: '000400'
              owner: root
              group: root
          services:
            sysvinit:
              cfn-hup:
                enabled: 'true'
                ensureRunning: 'true'
                files:
                  - /etc/cfn/cfn-hup.conf
                  - /etc/cfn/hooks.d/cfn-auto-reloader.conf
        install_wordpress:
          packages:
            yum:
              php73: []
              php73-mysqlnd: []
              mysql57: []
              mysql57-server: []
              mysql57-devel: []
              mysql57-libs: []
              httpd24: []
          sources:
            /var/www/html: 'http://wordpress.org/latest.tar.gz'
          files:
            /tmp/setup.mysql:
              content: !Join
                - ''
                - - 'CREATE DATABASE '
                  - !Ref DBName
                  - |
                    ;
                  - CREATE USER '
                  - !Ref DBUser
                  - '''@''localhost'' IDENTIFIED BY '''
                  - !Ref DBPassword
                  - |
                    ';
                  - 'GRANT ALL ON '
                  - !Ref DBName
                  - .* TO '
                  - !Ref DBUser
                  - |
                    '@'localhost';
                  - |
                    FLUSH PRIVILEGES;
              mode: '000400'
              owner: root
              group: root
            /tmp/create-wp-config:
              content: !Join
                - ''
                - - |
                    #!/bin/bash -xe
                  - >
                    cp /var/www/html/wordpress/wp-config-sample.php
                    /var/www/html/wordpress/wp-config.php
                  - sed -i "s/'database_name_here'/'
                  - !Ref DBName
                  - |
                    '/g" wp-config.php
                  - sed -i "s/'username_here'/'
                  - !Ref DBUser
                  - |
                    '/g" wp-config.php
                  - sed -i "s/'password_here'/'
                  - !Ref DBPassword
                  - |
                    '/g" wp-config.php
              mode: '000500'
              owner: root
              group: root
          services:
            sysvinit:
              httpd:
                enabled: 'true'
                ensureRunning: 'true'
              mysqld:
                enabled: 'true'
                ensureRunning: 'true'
        configure_wordpress:
          commands:
            01_set_mysql_root_password:
              command: !Join
                - ''
                - - mysqladmin -u root password '
                  - !Ref DBRootPassword
                  - ''''
              test: !Join
                - ''
                - - '$(mysql '
                  - !Ref DBName
                  - ' -u root --password='''
                  - !Ref DBRootPassword
                  - ''' >/dev/null 2>&1 </dev/null); (( $? != 0 ))'
            02_create_database:
              command: !Join
                - ''
                - - mysql -u root --password='
                  - !Ref DBRootPassword
                  - ''' < /tmp/setup.mysql'
              test: !Join
                - ''
                - - '$(mysql '
                  - !Ref DBName
                  - ' -u root --password='''
                  - !Ref DBRootPassword
                  - ''' >/dev/null 2>&1 </dev/null); (( $? != 0 ))'
            03_configure_wordpress:
              command: /tmp/create-wp-config
              cwd: /var/www/html/wordpress
    Properties:
      ImageId: !FindInMap
        - AWSRegionArch2AMI
        - !Ref 'AWS::Region'
        - !FindInMap
          - AWSInstanceType2Arch
          - !Ref InstanceType
          - Arch
      InstanceType: !Ref InstanceType
      SubnetId:
        Fn::ImportValue:
          !Sub "${EnvName}::PUBNET1"
      SecurityGroupIds:
        - !Ref WebServerSecurityGroup
      UserData: !Base64
        'Fn::Join':
          - ''
          - - |
              #!/bin/bash -xe
            - |
              yum update -y aws-cfn-bootstrap
            - '/opt/aws/bin/cfn-init -v '
            - '         --stack '
            - !Ref 'AWS::StackName'
            - '         --resource WebServer '
            - '         --configsets wordpress_install '
            - '         --region '
            - !Ref 'AWS::Region'
            - |+

            - '/opt/aws/bin/cfn-signal -e $? '
            - '         --stack '
            - !Ref 'AWS::StackName'
            - '         --resource WebServer '
            - '         --region '
            - !Ref 'AWS::Region'
            - |+

    CreationPolicy:
      ResourceSignal:
        Timeout: PT15M
Outputs:
  WebsiteURL:
    Value: !Join
      - ''
      - - 'http://'
        - !GetAtt
          - WebServer
          - PublicDnsName
        - /wordpress
    Description: WordPress Website


================================================
FILE: snippets/cloudformation/sample-nested.template.yaml
================================================
# export AWS_BUCKET="aws-pod-by-$USER"
# aws s3 mb s3://$AWS_BUCKET
# aws cloudformation package --template-file sample-nested.template.yaml --s3-bucket $AWS_BUCKET --output-template-file .sample-package.template.yaml
# aws cloudformation deploy --template-file .sample-package.template.yaml --stack-name "nested-$RANDOM" --capabilities CAPABILITY_IAM
Description: Sample nested stack
Resources:
    BucketStack:
        Type: AWS::CloudFormation::Stack
        Properties:
            TemplateURL: "sample-bucket.template.yaml"
    NetworkStack:
        Type: AWS::CloudFormation::Stack
        Properties:
            TemplateURL: "sample-network.template.yaml"
    DatabaseStack:
        DependsOn: NetworkStack
        Type: AWS::CloudFormation::Stack
        Properties:
            TemplateURL: "sample-database.template.yaml"
    InstanceStack:
        DependsOn: DatabaseStack
        Type: AWS::CloudFormation::Stack
        Properties:
            TemplateURL: "sample-instance.template.yaml"
Outputs:
    BucketName:
        Value: !GetAtt 'BucketStack.Outputs.BucketName'
        Description: The name of the S3 bucket

================================================
FILE: snippets/cloudformation/sample-network.template.yaml
================================================
# aws cloudformation create-stack --stack-name "network-$RANDOM" --template-body file://sample-network.template.yaml
Description: Sample network stack
Parameters:
  EnvName:
    Description: An environment name that is prefixed to resource names
    Type: String
    Default: devenv

  VpcCIDR:
    Description: IP range for this VPC
    Type: String
    Default: 10.192.0.0/16

  PublicSubnet0CIDR:
    Description: IP range for the public subnet in the first Availability Zone
    Type: String
    Default: 10.192.100.0/24

  PublicSubnet1CIDR:
    Description: IP range for the public subnet in the first Availability Zone
    Type: String
    Default: 10.192.101.0/24

  PublicSubnet2CIDR:
    Description: IP range for the public subnet in the second Availability Zone
    Type: String
    Default: 10.192.102.0/24

  PrivateSubnet1CIDR:
    Description: IP range for the private subnet in the first Availability Zone
    Type: String
    Default: 10.192.20.0/24

  PrivateSubnet2CIDR:
    Description: IP range for the private subnet in the second Availability Zone
    Type: String
    Default: 10.192.21.0/24

  DBPort:
    Description: Database Port
    Type: String
    Default: 3306

  DBAllowCidrIp:
    Description: Database Allowed Ingress
    Type: String
    Default: 0.0.0.0/0

Resources:
  VPC:
    Type: AWS::EC2::VPC
    Properties:
      CidrBlock: !Ref VpcCIDR
      EnableDnsSupport: true
      EnableDnsHostnames: true
      Tags:
        - Key: Name
          Value: !Ref EnvName

  InternetGateway:
    Type: AWS::EC2::InternetGateway
    Properties:
      Tags:
        - Key: Name
          Value: !Sub "${EnvName}/IGW"

  InternetGatewayAttachment:
    Type: AWS::EC2::VPCGatewayAttachment
    Properties:
      InternetGatewayId: !Ref InternetGateway
      VpcId: !Ref VPC

  PublicSubnet0:
    Type: AWS::EC2::Subnet
    DeletionPolicy: Delete
    Properties:
      VpcId: !Ref VPC
      AvailabilityZone: !Select [ 0, !GetAZs  '' ]
      CidrBlock: !Ref PublicSubnet0CIDR
      MapPublicIpOnLaunch: true
      Tags:
        - Key: Name
          Value: !Sub "${EnvName}/PublicSubnet0"
        - Key: kubernetes.io/role/elb
          Value: "1"

  PublicSubnet1:
    Type: AWS::EC2::Subnet
    DeletionPolicy: Delete
    Properties:
      VpcId: !Ref VPC
      AvailabilityZone: !Select [ 1, !GetAZs '' ]
      CidrBlock: !Ref PublicSubnet1CIDR
      MapPublicIpOnLaunch: true
      Tags:
        - Key: Name
          Value: !Sub "${EnvName}/PublicSubnet1"
        - Key: kubernetes.io/role/elb
          Value: "1"

  PublicSubnet2:
    Type: AWS::EC2::Subnet
    DeletionPolicy: Delete
    Properties:
      VpcId: !Ref VPC
      AvailabilityZone: !Select [ 2, !GetAZs  '' ]
      CidrBlock: !Ref PublicSubnet2CIDR
      MapPublicIpOnLaunch: true
      Tags:
        - Key: Name
          Value: !Sub "${EnvName}/PublicSubnet2"
        - Key: kubernetes.io/role/elb
          Value: "1"

  PrivateSubnet1:
    Type: AWS::EC2::Subnet
    DeletionPolicy: Delete
    Properties:
      VpcId: !Ref VPC
      AvailabilityZone: !Select [ 0, !GetAZs  '' ]
      CidrBlock: !Ref PrivateSubnet1CIDR
      MapPublicIpOnLaunch: false
      Tags:
        - Key: Name
          Value: !Sub '${AWS::StackName}/PrivateSubnet1'
        - Key: kubernetes.io/role/internal-elb
          Value: '1'

  PrivateSubnet2:
    Type: AWS::EC2::Subnet
    DeletionPolicy: Delete
    Properties:
      VpcId: !Ref VPC
      AvailabilityZone: !Select [ 1, !GetAZs  '' ]
      CidrBlock: !Ref PrivateSubnet2CIDR
      MapPublicIpOnLaunch: false
      Tags:
        - Key: Name
          Value: !Sub '${AWS::StackName}/PrivateSubnet2'
        - Key: kubernetes.io/role/internal-elb
          Value: '1'

  NatGateway1EIP:
    Type: AWS::EC2::EIP
    DependsOn: InternetGatewayAttachment
    Properties:
      Domain: vpc
      Tags:
        - Key: Name
          Value: !Sub '${AWS::StackName}/NATIP1'

  NatGateway2EIP:
    Type: AWS::EC2::EIP
    DependsOn: InternetGatewayAttachment
    Properties:
      Domain: vpc
      Tags:
        - Key: Name
          Value: !Sub '${AWS::StackName}/NATIP2'

  NatGateway1:
    Type: AWS::EC2::NatGateway
    Properties:
      AllocationId: !GetAtt NatGateway1EIP.AllocationId
      SubnetId: !Ref PublicSubnet1
      Tags:
        - Key: Name
          Value: !Sub '${AWS::StackName}/NAT1'

  NatGateway2:
    Type: AWS::EC2::NatGateway
    Properties:
      AllocationId: !GetAtt NatGateway2EIP.AllocationId
      SubnetId: !Ref PublicSubnet2
      Tags:
        - Key: Name
          Value: !Sub '${AWS::StackName}/NAT2'

  PublicRouteTable:
    Type: AWS::EC2::RouteTable
    Properties:
      VpcId: !Ref VPC
      Tags:
        - Key: Name
          Value: !Sub '${AWS::StackName}/PublicRouteTable'

  DefaultPublicRoute:
    Type: AWS::EC2::Route
    DependsOn: InternetGatewayAttachment
    Properties:
      RouteTableId: !Ref PublicRouteTable
      DestinationCidrBlock: 0.0.0.0/0
      GatewayId: !Ref InternetGateway

  PublicSubnet0RouteTableAssociation:
    Type: AWS::EC2::SubnetRouteTableAssociation
    Properties:
      RouteTableId: !Ref PublicRouteTable
      SubnetId: !Ref PublicSubnet0

  PublicSubnet1RouteTableAssociation:
    Type: AWS::EC2::SubnetRouteTableAssociation
    Properties:
      RouteTableId: !Ref PublicRouteTable
      SubnetId: !Ref PublicSubnet1

  PublicSubnet2RouteTableAssociation:
    Type: AWS::EC2::SubnetRouteTableAssociation
    Properties:
      RouteTableId: !Ref PublicRouteTable
      SubnetId: !Ref PublicSubnet2

  PrivateRouteTable1:
    Type: AWS::EC2::RouteTable
    Properties:
      VpcId: !Ref VPC
      Tags:
        - Key: Name
          Value: !Sub '${AWS::StackName}/PrivateRouteTable1'

  DefaultPrivateRoute1:
    Type: AWS::EC2::Route
    Properties:
      RouteTableId: !Ref PrivateRouteTable1
      DestinationCidrBlock: 0.0.0.0/0
      NatGatewayId: !Ref NatGateway1

  PrivateSubnet1RouteTableAssociation:
    Type: AWS::EC2::SubnetRouteTableAssociation
    Properties:
      RouteTableId: !Ref PrivateRouteTable1
      SubnetId: !Ref PrivateSubnet1

  PrivateRouteTable2:
    Type: AWS::EC2::RouteTable
    Properties:
      VpcId: !Ref VPC
      Tags:
        - Key: Name
          Value: !Sub '${AWS::StackName}/PrivateRouteTable2'

  DefaultPrivateRoute2:
    Type: AWS::EC2::Route
    Properties:
      RouteTableId: !Ref PrivateRouteTable2
      DestinationCidrBlock: 0.0.0.0/0
      NatGatewayId: !Ref NatGateway2

  PrivateSubnet2RouteTableAssociation:
    Type: AWS::EC2::SubnetRouteTableAssociation
    Properties:
      RouteTableId: !Ref PrivateRouteTable2
      SubnetId: !Ref PrivateSubnet2

Outputs:
  StackName:
    Description: Name of the created stack
    Value: !Ref AWS::StackName
    Export:
      Name: !Sub "${EnvName}::STACK"

  VPC:
    Description: A reference to the created VPC
    Value: !Ref VPC
    Export:
      Name: !Sub "${EnvName}::VPCID"

  PublicSubnets:
    Description: The list of the public subnets (YAML style A)
    Value: !Join
      - ','
      - - !Ref PublicSubnet0
        - !Ref PublicSubnet1
        - !Ref PublicSubnet2
    Export:
      Name: !Sub "${EnvName}::PUBNETS"

  PrivateSubnets:
    Description: The list of the private subnets (YAML style B)
    Value: !Join [ ",", [ !Ref PrivateSubnet1, !Ref PrivateSubnet2 ]]
    Export:
      Name: !Sub "${EnvName}::PRIVNETS"

  PublicSubnet0:
    Description: A reference to the public subnet in the 1st Availability Zone
    Value: !Ref PublicSubnet0
    Export:
      Name: !Sub "${EnvName}::PUBNET0"


  PublicSubnet1:
    Description: A reference to the public subnet in the 2nd Availability Zone
    Value: !Ref PublicSubnet1
    Export:
      Name: !Sub "${EnvName}::PUBNET1"

  PublicSubnet2:
    Description: A reference to the public subnet in the 3rd Availability Zone
    Value: !Ref PublicSubnet2
    Export:
      Name: !Sub "${EnvName}::PUBNET2"

  PrivateSubnet1:
    Description: A reference to the private subnet in the 1st Availability Zone
    Value: !Ref PrivateSubnet1
    Export:
      Name: !Sub "${EnvName}::PVTNET1"

  PrivateSubnet2:
    Description: A reference to the private subnet in the 2nd Availability Zone
    Value: !Ref PrivateSubnet2
    Export:
      Name: !Sub "${EnvName}::PVTNET2"



================================================
FILE: snippets/cloudformation/template-configuration.json
================================================
{}

================================================
FILE: snippets/fio-test-disk.sh
================================================
Using the Flexible I/O Tester

# Install FIO
brew install fio

https://linux.die.net/man/1/fio
https://www.binarylane.com.au/support/solutions/articles/1000055889-how-to-benchmark-disk-i-o

mkdir tmp;
cd tmp;

fio 
  # File name and location 
  --filename=/tmp/testfio \
  # Name of the test
  --name=fiotest \
  # Size of the test
  --size=16G \
  # Read/Write distribution
  --readwrite=randrw \
  --rwmixread=75 \
  # Block size (check https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/volume_constraints.html#block_size) 
  --bs=4k \
  
  --iodepth=1 \
  # Direct I/O to device (non-buffered)
  --direct=1 \
  # Reduce gettimeofday() calls
  --gtod_reduce=1 \

fio \
  --filename=./testfio \
  --name=fiotest \
  --size=16G \
  --readwrite=randrw \
  --rwmixread=75 \
  --bs=4k \
  --direct=1 \
  --gtod_reduce=1


================================================
FILE: snippets/user-data-alb-demo.sh
================================================
#!/bin/bash
yum -y install httpd
echo "Hello from $(curl -s http://instance-data/latest/meta-data/instance-id)" >> /var/www/html/index.html
systemctl enable httpd.service
systemctl start httpd.service


================================================
FILE: templates/route53_cname.tpl.json
================================================
{
    "Comment": "CREATE/DELETE/UPSERT a record ",
    "Changes": [{
    "Action": "CREATE",
                "ResourceRecordSet": {
                            "Name": "$RECORD_NAME",
                            "Type": "CNAME",
                            "TTL": 300,
                         "ResourceRecords": [{ "Value": "$RECORD_VALUE"}]
}}]
}

================================================
FILE: tutorial/ec2-wordpress-simple.md
================================================
# Wordpress on EC2 - Single Instance

## Prepare Web Server

Assume root user:
```
sudo -s
```

Install required packages:
```
yum -y update all
amazon-linux-extras enable php8.0
yum -y clean metadata
yum -y install httpd php php-gd php-mysqlnd mariadb
```

If you need a local database server:
```
mariadb-server
```

## Setup Database
Start mariadb and change password:
```
systemctl start mariadb
mysqladmin -uroot -p password 'Masterkey123' 
```

Connect to the database:
```
mysql -uroot pMasterkey123 -h127.0.0.1
```

Create database if needed:
```
CREATE DATABASE `wordpressdb`;
```


Create application user:
```
CREATE USER 'wpuser'@'%' IDENTIFIED BY 'Wordkey123';
GRANT ALL PRIVILEGES ON `wordpressdb`.* TO "wpuser"@"%";
FLUSH PRIVILEGES;
exit;
```

Check application user:
```
mysql -uwpuser -pWordkey123 -h127.0.0.1 wordpressdb
```

## Setup Wordpress
Edit httpd configuration:
```
sudo vim /etc/httpd/conf/httpd.conf
```
So that served directory allow .htaccess overides:
```
/var/www/html -> AllowOverride All
```

Restart httpd
```
service httpd start
```

Donwload and uncompress:
```
wget https://wordpress.org/latest.tar.gz
tar -xzf latest.tar.gz
```
Edit Wordpress configuration:
```
cp wordpress/wp-config-sample.php wordpress/wp-config.php
vi wordpress/wp-config.php
```

Change DB_NAME, DB_USER, DB_PASWORD

Copy wordpress to served directory and tighten permission
```
cp -r wordpress/* /var/www/html/
sudo chown -R apache /var/www
sudo chgrp -R apache /var/www
sudo chmod 2775 /var/www
find /var/www -type d -exec sudo chmod 2775 {} \;
find /var/www -type f -exec sudo chmod 0644 {} \;
```

# Finish Setup

Check internal and externall access:
```
curl localhost
curl http://instance-data/latest/meta-data/public-ipv4
curl $(curl http://instance-data/latest/meta-data/public-ipv4)
```

# Success!

Download .txt
gitextract_qocb_8p6/

├── LICENSE
├── LICENSE.txt
├── README.md
├── labs/
│   ├── ami-multiverse/
│   │   └── README.md
│   └── vpc-debug/
│       └── tf/
│           └── main.tf
├── scripts/
│   ├── git-push-all.sh
│   ├── git-release.sh
│   ├── instance-policy.json
│   └── instance-trust.json
├── snippets/
│   ├── aws-cli-demo.sh
│   ├── cloudformation/
│   │   ├── hello-bucket.template.yaml
│   │   ├── sample-bucket.template.yaml
│   │   ├── sample-codebuild.template.yaml
│   │   ├── sample-database.template.yaml
│   │   ├── sample-instance.template.yaml
│   │   ├── sample-nested.template.yaml
│   │   ├── sample-network.template.yaml
│   │   └── template-configuration.json
│   ├── fio-test-disk.sh
│   └── user-data-alb-demo.sh
├── templates/
│   └── route53_cname.tpl.json
└── tutorial/
    └── ec2-wordpress-simple.md
Condensed preview — 22 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (76K chars).
[
  {
    "path": "LICENSE",
    "chars": 11357,
    "preview": "                                 Apache License\n                           Version 2.0, January 2004\n                   "
  },
  {
    "path": "LICENSE.txt",
    "chars": 17128,
    "preview": "Creative Commons Attribution 3.0 Unported\r\nhttp://creativecommons.org/licenses/by/3.0/\r\n\r\nLicense\r\n\r\nTHE WORK (AS DEFINE"
  },
  {
    "path": "README.md",
    "chars": 97,
    "preview": "# aws-pod\n\nGitPod workspace for AWS\n\nhttps://gitpod.io/#https://github.com/CaravanaCloud/aws-pod\n"
  },
  {
    "path": "labs/ami-multiverse/README.md",
    "chars": 1152,
    "preview": "# Install SDKMan\n```\ncurl -s \"https://get.sdkman.io\" | bash\nsource \"/home/ec2-user/.sdkman/bin/sdkman-init.sh\"\n```\n\n# In"
  },
  {
    "path": "labs/vpc-debug/tf/main.tf",
    "chars": 6898,
    "preview": "# aws sts get-caller-identity\n# cd labs/vpc-debug/tf/\n# terraform init\n# terraform apply -auto-approve\n# terraform destr"
  },
  {
    "path": "scripts/git-push-all.sh",
    "chars": 82,
    "preview": "#/bin/bash\n\ngit commit --allow-empty -am \"WIP at $(date +%Y%m%d-%H%M%S)\"\ngit push\n"
  },
  {
    "path": "scripts/git-release.sh",
    "chars": 192,
    "preview": "#/bin/bash\n\nMAJOR=1\nMINOR=0\nPATCH=$(date +%Y%m%d%H%M%S)\nVERSION=\"$MAJOR.$MINOR.$PATCH\"\nTAG=\"v$VERSION\"\nNOTES=${NOTES:-\"A"
  },
  {
    "path": "scripts/instance-policy.json",
    "chars": 174,
    "preview": "{\r\n    \"Version\": \"2012-10-17\",\r\n    \"Statement\": [\r\n        {\r\n            \"Effect\": \"Allow\",\r\n            \"Action\": \"*"
  },
  {
    "path": "scripts/instance-trust.json",
    "chars": 247,
    "preview": "{\r\n    \"Version\": \"2012-10-17\",\r\n    \"Statement\": [\r\n        {\r\n            \"Effect\": \"Allow\",\r\n            \"Principal\":"
  },
  {
    "path": "snippets/aws-cli-demo.sh",
    "chars": 483,
    "preview": "aws sts get-caller-identity\n\naws configure \n\naws configure --profile myteam\nexport AWS_PROFILE=\"myteam\"\n\naws ec2 describ"
  },
  {
    "path": "snippets/cloudformation/hello-bucket.template.yaml",
    "chars": 165,
    "preview": "# aws cloudformation create-stack --stack-name \"bucket-$RANDOM\" --template-body file://hello-bucket.template.yaml\nResour"
  },
  {
    "path": "snippets/cloudformation/sample-bucket.template.yaml",
    "chars": 414,
    "preview": "# aws cloudformation create-stack --stack-name \"bucket-$RANDOM\" --template-body file://sample-bucket.template.yaml\nAWSTe"
  },
  {
    "path": "snippets/cloudformation/sample-codebuild.template.yaml",
    "chars": 3144,
    "preview": "# aws cloudformation create-stack --stack-name \"build-$RANDOM\" --template-body file://sample-codebuild.template.yaml --c"
  },
  {
    "path": "snippets/cloudformation/sample-database.template.yaml",
    "chars": 2008,
    "preview": "# aws cloudformation create-stack --stack-name \"database-$RANDOM\" --template-body file://sample-database.template.yaml\nD"
  },
  {
    "path": "snippets/cloudformation/sample-instance.template.yaml",
    "chars": 15502,
    "preview": "# aws cloudformation create-stack --stack-name \"instance-$RANDOM\" --template-body file://sample-instance.template\n\nAWSTe"
  },
  {
    "path": "snippets/cloudformation/sample-nested.template.yaml",
    "chars": 1130,
    "preview": "# export AWS_BUCKET=\"aws-pod-by-$USER\"\n# aws s3 mb s3://$AWS_BUCKET\n# aws cloudformation package --template-file sample-"
  },
  {
    "path": "snippets/cloudformation/sample-network.template.yaml",
    "chars": 8248,
    "preview": "# aws cloudformation create-stack --stack-name \"network-$RANDOM\" --template-body file://sample-network.template.yaml\nDes"
  },
  {
    "path": "snippets/cloudformation/template-configuration.json",
    "chars": 2,
    "preview": "{}"
  },
  {
    "path": "snippets/fio-test-disk.sh",
    "chars": 819,
    "preview": "Using the Flexible I/O Tester\n\n# Install FIO\nbrew install fio\n\nhttps://linux.die.net/man/1/fio\nhttps://www.binarylane.co"
  },
  {
    "path": "snippets/user-data-alb-demo.sh",
    "chars": 201,
    "preview": "#!/bin/bash\nyum -y install httpd\necho \"Hello from $(curl -s http://instance-data/latest/meta-data/instance-id)\" >> /var/"
  },
  {
    "path": "templates/route53_cname.tpl.json",
    "chars": 348,
    "preview": "{\n    \"Comment\": \"CREATE/DELETE/UPSERT a record \",\n    \"Changes\": [{\n    \"Action\": \"CREATE\",\n                \"ResourceRe"
  },
  {
    "path": "tutorial/ec2-wordpress-simple.md",
    "chars": 1822,
    "preview": "# Wordpress on EC2 - Single Instance\n\n## Prepare Web Server\n\nAssume root user:\n```\nsudo -s\n```\n\nInstall required package"
  }
]

About this extraction

This page contains the full source code of the CaravanaCloud/aws-pod GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 22 files (69.9 KB), approximately 19.2k tokens. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!