Пример #1
0
def create_alias_record(alias_domain, distribution):
    zone_id = route53.get_zone(name=alias_domain).id
    return route53.Record(alias_domain,
                          name="",
                          zone_id=zone_id,
                          type='A',
                          aliases=[
                              route53.RecordAliasArgs(
                                  name=distribution.domain_name,
                                  zone_id=distribution.hosted_zone_id,
                                  evaluate_target_health=True,
                              )
                          ])
Пример #2
0
def find_zone(domain):
    """
    Attempts to find the Route53 zone for the given domain.
    """
    # FIXME: Cache these results
    zonename = domain
    while '.' in zonename:
        try:
            zone = route53.get_zone(name=zonename)
        except Exception:
            _, zonename = zonename.split('.', 1)
        else:
            return zone
    else:
        raise ZoneNotFoundError(f"Unable to find zone for domain {domain}")
Пример #3
0
import pulumi
from putils import opts
from staticsite import StaticSite
from pulumi_aws import route53

config = pulumi.Config('castle')

zone = route53.get_zone(name='dingbots.dev')

# Create an AWS resource (S3 Bucket)
site = StaticSite(
    'MainSite',
    domain=config.require('domain'),
    zone=zone,
    content_dir='www',
    **opts(),
)
pulumi.export('website', site.url)
 def get_hosted_zone(self):
     """
     Get Route53 Hosted Zone
     """
     zone = route53.get_zone(name=self.zone_name)
     return zone