route53: HostedZone should have a `hostedZoneArn` property
See original GitHub issue❓ General Issue
The Question
I’m trying to create a IAM group with a policy attached to change DNS records for a Route53 hosted zone.
This is my code:
const group = new iam.Group(this, 'group', {
groupName: 'ci-ui-iam-group'
})
const zone = route53.HostedZone.fromLookup(this, 'zone', {
domainName: 'mydomain.com'
})
group.addManagedPolicy(
new iam.ManagedPolicy(this, 'AllowChangeRecordSets', {
managedPolicyName: 'allow-change-record-sets',
statements: [
new iam.PolicyStatement({
effect: iam.Effect.ALLOW,
resources: [`arn:aws:route53:::${zone.hostedZoneId}`],
actions: ['route53:ChangeResourceRecordSets']
})
]
})
)
It creates the group as well as the policy, whose JSON looks like this:
{
"Version": "2012-10-17",
"Statement": [
{
"Action": "route53:ChangeResourceRecordSets",
"Resource": "arn:aws:route53:::/hostedzone/<SomeHostedZoneId>",
"Effect": "Allow"
}
]
}
When opening the new Policy in AWS Console, I get this warning:
When changing the Resource
entry like this (removing the /
before hostedzone
):
"Resource": "arn:aws:route53:::hostedzone/<SomeHostedZoneId>",
the policy is fixed.
So my question is: can I get hostedzone/<SomeHostedZoneId>
using AWS CDK instead of /hostedzone/<SomeHostedZoneId>
so I don’t have to remove the leading /
myself?
Or even better: is there a function in the CDK which allows me to get the full ARN for this zone?
Environment
- CDK CLI Version: 1.15.0
- Module Version: 1.15.0
- OS: Darwin mbp.local 19.0.0 Darwin Kernel Version 19.0.0: Wed Sep 25 20:18:50 PDT 2019; root:xnu-6153.11.26~2/RELEASE_X86_64 x86_64
- Language: TypeScript
Other information
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
AWS::Route53::HostedZone - AWS CloudFormation
When creating private hosted zones, the Amazon VPC must belong to the same partition where the hosted zone is created. A partition is...
Read more >AWS::Route53::HostedZone - Amazon CloudFormation
Creates a new public or private hosted zone. You create records in a public hosted zone to define how you want to route...
Read more >How do I determine the ARN of my Amazon route53-hosted ...
Resource is either hostedzone or change , and ID is the ID of the hosted zone or the change. The following are examples...
Read more >aws.route53.Record - Pulumi
Changes to this property will trigger replacement. string. Hosted zone ID for a CloudFront distribution, S3 bucket, ELB, or Route 53 hosted zone....
Read more >Route53 - Go Packages
Package route53 provides the client and types for making API requests to Amazon Route 53. ... The hosted // zone and parent must...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Having consistent behavior between creating the
HostedZone
and importing it usingroute53.HostedZone.fromLookup
would be great.I think the entire
/hostedzone/
part should be removed. This attribute should just return the ID of the hosted zone.