Skip to content
v2.274.0

PhysicalResourceId Class ​

Physical ID of the custom resource.

Example ​

ts
const crossAccountRoleArn = 'arn:aws:iam::OTHERACCOUNT:role/CrossAccountRoleName'; // arn of role deployed in separate account

const callRegion = 'us-west-1'; // sdk call to be made in specified region (optional)

new cr.AwsCustomResource(this, 'CrossAccount', {
  onCreate: {
    assumedRoleArn: crossAccountRoleArn,
    region: callRegion, // optional
    service: 'sts',
    action: 'GetCallerIdentity',
    physicalResourceId: cr.PhysicalResourceId.of('id'),
  },
  policy: cr.AwsCustomResourcePolicy.fromStatements([iam.PolicyStatement.fromJson({
    Effect: "Allow",
    Action: "sts:AssumeRole",
    Resource: crossAccountRoleArn,
  })]),
});

Properties ​

idstringidstridStringIdstringId*string#
Literal string to be used as the physical id.
responsePathstringresponse_pathstrresponsePathStringResponsePathstringResponsePath*string#
Path to a response data element to be used as the physical id.

Methods ​

fromResponse(responsePath: string): PhysicalResourceId // chainable@staticmethod def from_response(response_path: str) -> PhysicalResourceIdpublic static PhysicalResourceId fromResponse(String responsePath)public static PhysicalResourceId FromResponse(string responsePath)func FromResponse(ResponsePath *string) PhysicalResourceIdstatic#
Extract the physical resource id from the path (dot notation) to the data in the API call response.
of(id: string): PhysicalResourceId // chainable@staticmethod def of(id: str) -> PhysicalResourceIdpublic static PhysicalResourceId of(String id)public static PhysicalResourceId Of(string id)func Of(Id *string) PhysicalResourceIdstatic#
Explicit physical resource id.