MechCloud
  • What is MechCloud?
  • MechCloud Website
  • Launch Portal
  • Links
    • Discord
    • Youtube
    • Blog
    • LinkedIn
    • Twitter
  • Comparison With WordPress
  • Tutorials / Blog Posts
  • Administration
    • Multitenancy
      • Tenant
      • Team
    • Subscriptions
      • Basic
      • Pro
  • Cloud Computing
    • Cloud Accounts
      • Add An Account
        • AWS
        • GCP
        • Azure
      • Configure Regions / Zones
      • Discover Assets
      • Real-time Visualization
        • AWS
          • Tags
          • CloudTrail
        • GCP
  • AI Agents
    • AWS Agent
      • EC2
      • Lightsail
      • Multi-operation Prompts
    • Systems Agent
      • Cloudflare
      • MongoDB Atlas API
  • Website Builder
    • Routing
    • Micro app based architecture
    • Site
    • Site Node
    • Custom Components
      • Frame
      • Layout
      • External Page
      • Component
    • Special Tags
      • <mc-navigation-link>
      • <mc-render-node>
    • Page Designer
      • Single Component Prompts
        • Native HTML tags
        • MechCloud UI Components
        • Demo Components
        • Third Party Components
      • Multi Components Prompts
Powered by GitBook
On this page

Was this helpful?

  1. AI Agents
  2. AWS Agent

Multi-operation Prompts

This page describes multi-operation prompts which can be used to trigger more than one operations in a single prompt where all operations can be either ec2 operations or lightsail operations or a mixture of operations from ec2 and lightsail.

Examples

Creating a vpc with a child subnet

create a vpc with '10.101.0.0/16' cidr
  create a subnet with '10.101.1.0/24' cidr

Adding two spaces in front of a line will establish parent / child relationship between this resource and the resource created by the previous line. Otherwise all the resources will be provisioned without any relationship with each other.

Creating a security group and adding ingress rules to it

create a security group with following details -
name - securitygroup-ssh-https
description - Allow access on ssh and https ports
-----
  add following ingress rules -
  22|tcp|192.168.1.1
  443|tcp|192.168.2.0/24

Listing vpcs and subnets

list all the vpcs
list all the subnets

Provisioning a Lightsail Docker host

import a lightsail key pair with following details -
name - key1
key - <public_key_content>
-----
create a lightsail vm with following details -
name(s) - instance1
zone - eu-west-1a
blueprint - ubuntu_24_04
bundle - nano_3_0
ssh key - key1
user data - "curl -fsSL https://raw.githubusercontent.com/mechcloud/sample-scripts/refs/heads/main/install-docker.sh | bash"
-----
replace firewall rules of 'instance1' lightsail vm with following -
22|tcp|@CURRENT_IP
443|tcp|@CURRENT_IP

Troubleshooting user data

  • Check user-data file content -

sudo cat /var/lib/cloud/instance/user-data.txt
  • Check cloud-init logs -

sudo cat /var/log/cloud-init-output.log

Query multiple resources required for provisioning an EC2 VM

list images
list instance types which are free tier eligible
list ec2 key pairs
-----
list security groups with following name -
securitygroup-ssh-https

Provisioning an EC2 Docker host

At this moment base64_encode function is not supported in the prompt. It has been mentioned here to inform the user that the data should be manually base64 encoded and updated in place of base64_ecode() function call.

import an ec2 key pair with following details -
name - <key_name>
key - base64_encode(<key_content>)
-----
create a security group with following details -
name - <sg_name>
description - Allow access on ssh
-----
  add following ingress rules -
  22|tcp|@CURRENT_IP
-----
create an ec2 vm with following details -
ami - <ami_id>
instance type - <instance_type>
key - <key_name>
security group - <sg_id>
user data - base64_encode("#!/bin/bash\ncurl -fsSL https://raw.githubusercontent.com/mechcloud/sample-scripts/refs/heads/main/install-docker.sh | bash")

Trigger a lightsail operation on multiple resources even though AWS API supports performing this operation on one resource at a time

reboot following lightsail VMs -
instance1
instance2
PreviousLightsailNextSystems Agent

Last updated 2 months ago

Was this helpful?