AWS useful commands


Stop ec2 instance

aws ec2 stop-instances --instance-ids <ec2-id>

Start ec2 instance

aws ec2 start-instances --instance-ids <ec2-id>


Create an AMI from ec2 instance

aws ec2 create-image --instance-id <ec2-id> --name <new ami name>

Deregister AMI

aws ec2 deregister-image --image-id <ami-id>

Route53 List hosted zones

aws route53 list-hosted-zones

The output will be similar to the following:

    "Id": "/hostedzone/ZZOODDASDDAAAA",
    "Name": "",
    "CallerReference": "RISWorkflow-RD:cccccccc-dddd-1234-5678-123412341234",
    "Config": {
        "Comment": "HostedZone created by Route53 Registrar",
        "PrivateZone": false
    "ResourceRecordSetCount": 10

Records from a zone

aws route53 list-resource-record-sets --hosted-zone-id ZZOODDASDDAAAA

And this will be in the output:

    "Name": "",
    "Type": "A",
    "AliasTarget": {
        "HostedZoneId": "ZZOODDASDDAAAA",
        "DNSName": "dns-for-aws-lb",
        "EvaluateTargetHealth": true