SELECT * FROM iasql_install('<modules>');
INSERT INTO hosted_zone (domain_name)
VALUES ('<domainName>');
SELECT *
FROM hosted_zone
WHERE domain_name = '<domainName>';
SELECT *
FROM resource_record_set
INNER JOIN hosted_zone ON hosted_zone.id = parent_hosted_zone_id
WHERE domain_name = '<domainName>';
INSERT INTO resource_record_set (name, record_type, record, ttl, parent_hosted_zone_id)
SELECT '<resourceRecordSetName>', '<resourceRecordSetTypeCNAME>', '<resourceRecordSetRecord>',<resourceRecordSetTtl>, id
FROM hosted_zone
WHERE domain_name = '<domainName>';
SELECT *
FROM resource_record_set
INNER JOIN hosted_zone ON hosted_zone.id = parent_hosted_zone_id
WHERE domain_name = '<domainName>';
BEGIN;
INSERT INTO load_balancer (load_balancer_name, scheme, load_balancer_type, ip_address_type)
VALUES ('<lbName>', '<lbScheme>', '<lbType>', '<lbIPAddressType>');
INSERT INTO alias_target (load_balancer_id)
VALUES ((SELECT id FROM load_balancer WHERE load_balancer_name = '<lbName>'));
INSERT INTO resource_record_set (name, record_type, parent_hosted_zone_id, alias_target_id)
SELECT '<aliasResourceRecordSetName>', '<resourceRecordSetTypeA>', hosted_zone.id, alias_target.id
FROM hosted_zone, alias_target
INNER JOIN load_balancer ON load_balancer.id = alias_target.load_balancer_id
WHERE domain_name = '<domainName>' AND load_balancer.load_balancer_name = '<lbName>';
COMMIT;
SELECT *
FROM resource_record_set
INNER JOIN hosted_zone ON hosted_zone.id = parent_hosted_zone_id
WHERE domain_name = '<domainName>';
INSERT INTO resource_record_set (name, record_type, record, ttl, parent_hosted_zone_id)
SELECT '<resourceRecordSetMultilineName>', '<resourceRecordSetTypeA>', '<resourceRecordSetRecordMultiline>',<resourceRecordSetTtl>, id
FROM hosted_zone
WHERE domain_name = '<replaceDomainName>';
SELECT *
FROM resource_record_set
INNER JOIN hosted_zone ON hosted_zone.id = parent_hosted_zone_id
WHERE domain_name = '<replaceDomainName>';
UPDATE resource_record_set
SET name = '<resourceRecordSetMultilineNameReplace>'
FROM hosted_zone
WHERE domain_name = '<replaceDomainName>' AND name = '<resourceRecordSetMultilineName>';
SELECT *
FROM resource_record_set
INNER JOIN hosted_zone ON hosted_zone.id = parent_hosted_zone_id
WHERE domain_name = '<replaceDomainName>';
BEGIN;
DELETE FROM resource_record_set
USING hosted_zone
WHERE hosted_zone.id IN (SELECT id FROM hosted_zone WHERE domain_name = '<replaceDomainName>' ORDER BY ID DESC LIMIT 1);
DELETE FROM hosted_zone
WHERE id IN (SELECT id FROM hosted_zone WHERE domain_name = '<replaceDomainName>' ORDER BY ID DESC LIMIT 1);
COMMIT;
DELETE FROM resource_record_set
USING hosted_zone
WHERE hosted_zone.id = parent_hosted_zone_id AND domain_name = '<replaceDomainName>';
SELECT *
FROM resource_record_set
INNER JOIN hosted_zone ON hosted_zone.id = parent_hosted_zone_id
WHERE domain_name = '<replaceDomainName>';
BEGIN;
DELETE FROM resource_record_set
USING hosted_zone
WHERE hosted_zone.id = parent_hosted_zone_id AND domain_name = '<replaceDomainName>';
DELETE FROM hosted_zone
WHERE domain_name = '<replaceDomainName>';
COMMIT;
SELECT *
FROM resource_record_set
INNER JOIN hosted_zone ON hosted_zone.id = parent_hosted_zone_id
WHERE domain_name = '<replaceDomainName>';
SELECT *
FROM hosted_zone
WHERE domain_name = '<replaceDomainName>';