### Dockerfile for Hello World Static Website Source: https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-creating-container-images Use this Dockerfile to create a container image for a static website that displays a 'Hello World!' message. It installs Apache on Ubuntu 18.04, configures the document root, exposes port 80, and starts the Apache service. ```dockerfile FROM ubuntu:18.04 # Install dependencies RUN apt-get update && \ apt-get -y install apache2 # Write hello world message RUN echo 'Hello World!' > /var/www/html/index.html # Open port 80 EXPOSE 80 # Start Apache service CMD ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"] ``` -------------------------------- ### Example of Configuring GitLab CE Domain Name Source: https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-quick-start-guide-gitlab.md An example of the domain configuration command with a sample domain name. ```bash sudo /opt/bitnami/configure_app_domain --domain {{example.com}} ``` -------------------------------- ### Example Magento Domain Configuration Command Source: https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-quick-start-guide-magento.md An example of the command to configure the Magento domain name, using a placeholder domain. ```bash sudo /opt/bitnami/configure_app_domain --domain {{www.example.com}} ``` -------------------------------- ### Example WHM Console URL Source: https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-quick-start-guide-cpanel.md An example of how to format the WHM console URL with a specific domain name. ```text https//{{management.example.com}}/whm ``` -------------------------------- ### Enable Prometheus to Start on Boot Source: https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-install-prometheus.md This command configures the Prometheus service to automatically start whenever the instance boots up. ```bash sudo systemctl enable prometheus ``` -------------------------------- ### Move Lego client to installation directory Source: https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-quick-start-guide-gitlab.md Move the extracted Lego client executable to the designated installation directory. ```bash sudo mv lego /opt/bitnami/letsencrypt/lego ``` -------------------------------- ### Example: Download Default Key Pair Source: https://docs.aws.amazon.com/lightsail-for-research/latest/ug/get-ssh-keys.md An example of the AWS CLI command to download the default Lightsail key pair for the us-east-2 region. ```bash aws lightsail download-default-key-pair --region {{us-east-2}} > dkp-details.json ``` -------------------------------- ### Install Certbot Source: https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-lets-encrypt-certbot-lamp-lightsail.md Installs Certbot, the client used to request and deploy SSL certificates from Let's Encrypt. ```bash sudo apt-get install certbot -y ``` -------------------------------- ### Enable Node Exporter to Start on Boot Source: https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-install-prometheus.md This command configures the Node Exporter service to automatically start when the instance boots up. ```bash sudo systemctl enable node_exporter ``` -------------------------------- ### Lightsail Bucket Access Log: User-Agent Example Source: https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-bucket-access-log-format.md Example entry for the 'User-Agent' field, showing the value of the HTTP User-Agent header. ```text "curl/7.15.1" ``` -------------------------------- ### Lightsail Bucket Access Log: Turn-Around Time Example Source: https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-bucket-access-log-format.md Example entry for the 'Turn-Around Time' field, indicating the milliseconds Lightsail spent processing the request. ```text 10 ``` -------------------------------- ### Lightsail Bucket Access Log: Bucket Name Example Source: https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-bucket-access-log-format.md Example entry for the 'Bucket' field, showing the name of the bucket storing the object. ```text amzn-s3-demo-bucket ``` -------------------------------- ### Example: Connect to MySQL 5.7+ with SSL Source: https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-connecting-to-mysql-database-using-ssl.md An example demonstrating how to connect to a MySQL 5.7 or later database using SSL, with sample values for the database endpoint, certificate path, and username. ```bash mysql -h {{ls-1c51a7c70a4fb55e542829a4e4e0d735ba42.czowadgeezqi.us-west-2.rds.amazonaws.com}} --ssl-ca={{/home/ec2-user/rds-combined-ca-bundle.pem}} --ssl-mode=VERIFY_IDENTITY -u {{dbmasteruser}} -p ``` -------------------------------- ### Example UserdataExecution log output Source: https://docs.aws.amazon.com/lightsail/latest/userguide/create-powershell-script-that-runs-when-you-create-windows-based-instance-in-lightsail.md This is an example of the expected output in the UserdataExecution.log file after a successful PowerShell script execution, such as installing Chocolatey. ```text 2017/10/11 20:32:12Z: tag was provided.. running powershell content 2017/10/11 20:32:13Z: Message: The output from user scripts: iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) 2017/10/11 20:32:13Z: Userdata execution done ``` -------------------------------- ### Lightsail Bucket Access Log: HTTP Status Example Source: https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-bucket-access-log-format.md Example entry for the 'HTTP status' field, indicating the numeric HTTP status code of the GET portion of a copy operation. ```text 200 ``` -------------------------------- ### Example: Connect to MySQL 5.6 or earlier with SSL Source: https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-connecting-to-mysql-database-using-ssl.md An example showing how to connect to a MySQL 5.6 or earlier database using SSL, with sample values for the database endpoint, certificate path, and username. ```bash mysql -h {{ls-1c51a7c70a4fb55e542829a4e4e0d735ba42.czowadgeezqi.us-west-2.rds.amazonaws.com}} --ssl-ca={{/home/ec2-user/rds-combined-ca-bundle.pem}} --ssl-verify-server-cert -u {{dbmasteruser}} -p ``` -------------------------------- ### Lightsail Bucket Access Log: Error Code Example Source: https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-bucket-access-log-format.md Example entry for the 'Error Code' field, showing the Amazon S3 error code for the GET portion or '-' if no error occurred. ```text NoSuchBucket ``` -------------------------------- ### Example: Create Symbolic Links for Let's Encrypt Certificates Source: https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-quick-start-guide-gitlab.md An example demonstrating how to create symbolic links for Let's Encrypt certificates using a specific domain. Ensure {{example.com}} is replaced with your domain. ```bash sudo ln -sf /opt/bitnami/letsencrypt/certificates/{{example.com}}.key /etc/gitlab/ssl/tls.key && \ sudo ln -sf /opt/bitnami/letsencrypt/certificates/{{example.com}}.crt /etc/gitlab/ssl/tls.crt ``` -------------------------------- ### Example lsblk output for current generation instances Source: https://docs.aws.amazon.com/lightsail/latest/userguide/create-and-attach-additional-block-storage-disks-linux-unix.md This example shows the output of `lsblk` for current generation instances, highlighting the root volume and an additional unpartitioned disk. ```text [ec2-user ~]$ sudo lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT nvme1n1 259:0 0 30G 0 disk /data nvme0n1 259:1 0 16G 0 disk └─nvme0n1p1 259:2 0 8G 0 part / └─nvme0n1p128 259:3 0 1M 0 part ``` -------------------------------- ### Manage OpenClaw Gateway Service Source: https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-quick-start-guide-openclaw.md Use these commands to stop, start, or check the status of the OpenClaw gateway service, typically after installing plugins or updating configurations. ```bash openclaw gateway stop ``` ```bash openclaw gateway start ``` ```bash openclaw gateway status ``` -------------------------------- ### Example lsblk output for previous generation instances Source: https://docs.aws.amazon.com/lightsail/latest/userguide/create-and-attach-additional-block-storage-disks-linux-unix.md This example shows the output of `lsblk` for previous generation instances, illustrating the root volume and an additional unpartitioned disk. ```text [ec2-user ~]$ sudo lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT xvda 202:0 0 16G 0 disk └─xvda1 202:1 0 8G 0 part / xvdf 202:80 0 24G 0 disk ``` -------------------------------- ### Get current minimum TLS protocol version Source: https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-configure-distribution-tls-version.md This example shows the expected output format when querying for the minimum TLS protocol version of a Lightsail distribution. ```json "viewerMinimumTlsProtocolVersion": "TLSv1.2_2021" ``` -------------------------------- ### Create a CORS configuration JSON file Source: https://docs.aws.amazon.com/lightsail/latest/userguide/cors-configuration-cli.md Create a JSON file to define your CORS rules. This example allows GET, PUT, and POST requests from a specific origin. ```json { "CORSRules": [ { "AllowedOrigins": ["https://example.com"], "AllowedMethods": ["GET", "PUT", "POST"], "AllowedHeaders": ["*"], "MaxAgeSeconds": 3000 } ] } ``` -------------------------------- ### Example: List all object keys in a demo bucket using AWS CLI Source: https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-viewing-objects-in-a-bucket.md An example demonstrating how to list all object keys and their sizes for a specific bucket named '{{amzn-s3-demo-bucket}}'. ```bash aws s3api list-objects-v2 --bucket {{amzn-s3-demo-bucket}} --query "Contents[].{Key: Key, Size: Size}" ``` -------------------------------- ### Get Plesk One-Time Login URL Source: https://docs.aws.amazon.com/lightsail/latest/userguide/set-up-and-configure-plesk-stack-on-lightsail.md Run this command via SSH to obtain a temporary URL for accessing the Plesk interface. This URL is required for the initial login and setup. ```bash sudo plesk login | grep plesk.page ``` -------------------------------- ### Download bncert-tool run file Source: https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-enabling-https-on-wordpress-with-bncert.md Use this command to download the bncert run file to your instance. This is the first step in installing the tool if it's not already present. ```bash wget -O bncert-linux-x64.run https://downloads.bitnami.com/files/bncert/latest/bncert-linux-x64.run ``` -------------------------------- ### StartInstance Source: https://docs.aws.amazon.com/lightsail-for-research/latest/ug/api-actions.md Starts a specific virtual computer from a stopped state. To restart a virtual computer, use the `reboot instance` operation. ```APIDOC ## StartInstance ### Description Starts a specific virtual computer from a stopped state. To restart a virtual computer, use the `reboot instance` operation. ``` -------------------------------- ### Dockerfile for Custom HTML Static Website Source: https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-creating-container-images This Dockerfile is for creating a container image of a static website using your own HTML files. It installs Apache on Ubuntu 18.04, copies the contents of an 'html' folder to the web server's document root, exposes port 80, and starts the Apache service. ```dockerfile FROM ubuntu:18.04 # Install dependencies RUN apt-get update && \ apt-get -y install apache2 # Copy html directory files COPY html /var/www/html/ # Open port 80 EXPOSE 80 CMD ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"] ``` -------------------------------- ### Start Node Exporter Service Source: https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-install-prometheus.md This command starts the Node Exporter service, which collects system metrics. ```bash sudo systemctl start node_exporter ``` -------------------------------- ### Example: Add distribution default domain (with custom domains) Source: https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-adding-distribution-default-domain-to-container-service.md An example of the command to add a distribution's default domain to a container service when custom domains are already configured. Replace `{{ContainerServiceName}}`, `{{example-com}}`, `{{example.com}}`, and `{{example123.cloudfront.net}}` with your specific values. ```bash aws lightsail update-container-service --service-name {{ContainerServiceName}} --public-domain-names '{"{{example-com}}": ["{{example.com}}"],"_": ["{{example123.cloudfront.net}}"]}' ``` -------------------------------- ### Initialize Lightsail Service (Go - Dual-stack) Source: https://docs.aws.amazon.com/lightsail/latest/userguide/access-lightsail.md Set up the AWS SDK for Go to interact with Lightsail in us-east-2 using a dual-stack endpoint. ```go sess := session.Must(session.NewSession()) svc := lightsail.New(sess, &aws.Config{ Region: aws.String(endpoints.UsEast2RegionID), Endpoint: aws.String("https://{{lightsail.us-east-2.api.aws}}") }) ``` -------------------------------- ### Example of deleting a Lightsail bucket using the AWS CLI Source: https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-deleting-buckets.md This is an example of the delete-bucket command for a bucket named 'amzn-s3-demo-bucket'. ```bash aws lightsail delete-bucket --bucket-name {{amzn-s3-demo-bucket}} ``` -------------------------------- ### Create directory for Lego client Source: https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-quick-start-guide-gitlab.md Create the /opt/bitnami/letsencrypt directory to store the Lego client executable and certificate files. ```bash sudo mkdir -p /opt/bitnami/letsencrypt ``` -------------------------------- ### Example: Add distribution default domain (no custom domain) Source: https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-adding-distribution-default-domain-to-container-service.md An example of the command to add a distribution's default domain to a container service when no custom domains are configured. Replace `{{ContainerServiceName}}` and `{{example123.cloudfront.net}}` with your specific values. ```bash aws lightsail update-container-service --service-name {{ContainerServiceName}} --public-domain-names '{"_": ["{{example123.cloudfront.net}}"]}' ``` -------------------------------- ### Example Log Object Key Format Source: https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-bucket-access-logs This example shows the format of a log object key when a prefix is specified. The prefix helps in organizing and identifying log objects. ```text logs/2021-11-31-21-32-16-E568B2907131C0C0 ``` -------------------------------- ### Create Lightsail WordPress Instance Source: https://docs.aws.amazon.com/lightsail/latest/userguide/getstarted-awscli.md Creates a new WordPress instance using the 'nano_3_0' bundle and associates it with the 'cli-tutorial-keys' key pair. The instance is created in an availability zone within your configured AWS Region. ```bash aws lightsail create-instances --instance-names cli-tutorial \ --availability-zone ${AWS_REGION}a --blueprint-id wordpress \ --bundle-id nano_3_0 --key-pair-name cli-tutorial-keys ``` -------------------------------- ### Example Magento Admin Dashboard URL Source: https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-quick-start-guide-magento.md An example of the Magento administration dashboard URL using a placeholder IP address. ```text http://{{203.0.113.0}}/admin ``` -------------------------------- ### Open Apache Virtual Host Configuration File (Approach A) Source: https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-quick-start-guide-joomla.md Use this command to open the Apache virtual host configuration file for editing with Vim. This is part of Approach A for setting up virtual hosts. ```bash sudo vim /opt/bitnami/apache2/conf/vhosts/joomla-vhost.conf ``` -------------------------------- ### Create XFS file system (Current generation) Source: https://docs.aws.amazon.com/lightsail/latest/userguide/create-and-attach-additional-block-storage-disks-linux-unix.md Format a new disk with the XFS file system. Replace {{device_name}} with your disk's device name. This command overwrites existing data. ```bash sudo mkfs -t xfs {{device_name}} ``` ```bash meta-data=/dev/nvme1n1 isize=512 agcount=16, agsize=1048576 blks = sectsz=512 attr=2, projid32bit=1 = crc=1 finobt=1, sparse=1, rmapbt=0 = reflink=1 bigtime=1 inobtcount=1 data = bsize=4096 blocks=16777216, imaxpct=25 = sunit=1 swidth=1 blks naming =version 2 bsize=4096 ascii-ci=0, ftype=1 log =internal log bsize=4096 blocks=16384, version=2 = sectsz=512 sunit=1 blks, lazy-count=1 realtime =none extsz=4096 blocks=0, rtextents=0 ```