cdk-local 0.163.5 → 0.164.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -568,21 +568,319 @@ const AWS_ENDPOINT_SERVICE_IDS = /* @__PURE__ */ new Set([
568
568
  "XRAY"
569
569
  ]);
570
570
 
571
+ //#endregion
572
+ //#region src/local/aws-real-endpoints.ts
573
+ const AWS_ENDPOINT_PREFIX_OVERRIDES = {
574
+ ACCESSANALYZER: "access-analyzer",
575
+ ACCOUNT_ACCESS: "account-access",
576
+ ACM_PCA: "acm-pca",
577
+ AGENT_REGISTRY: "agent-registry",
578
+ AGENT_REGISTRY_CONTROL: "agent-registry-control",
579
+ AMP: "aps",
580
+ APIGATEWAYMANAGEMENTAPI: "execute-api",
581
+ APIGATEWAYV2: "apigateway",
582
+ APPINTEGRATIONS: "app-integrations",
583
+ APPLICATIONCOSTPROFILER: "application-cost-profiler",
584
+ APPLICATION_AUTO_SCALING: "application-autoscaling",
585
+ APPLICATION_DISCOVERY_SERVICE: "discovery",
586
+ APPLICATION_SIGNALS: "application-signals",
587
+ APPSTREAM: "appstream2",
588
+ ARC_REGION_SWITCH: "arc-region-switch",
589
+ ARC_ZONAL_SHIFT: "arc-zonal-shift",
590
+ AUTO_SCALING_PLANS: "autoscaling-plans",
591
+ BACKUPSEARCH: "backup-search",
592
+ BACKUP_GATEWAY: "backup-gateway",
593
+ BCM_DASHBOARDS: "bcm-dashboards",
594
+ BCM_DATA_EXPORTS: "bcm-data-exports",
595
+ BCM_PRICING_CALCULATOR: "bcm-pricing-calculator",
596
+ BCM_RECOMMENDED_ACTIONS: "bcm-recommended-actions",
597
+ BEDROCK_AGENT: "bedrock-agent",
598
+ BEDROCK_AGENTCORE: "bedrock-agentcore",
599
+ BEDROCK_AGENTCORE_CONTROL: "bedrock-agentcore-control",
600
+ BEDROCK_AGENT_RUNTIME: "bedrock-agent-runtime",
601
+ BEDROCK_DATA_AUTOMATION: "bedrock-data-automation",
602
+ BEDROCK_DATA_AUTOMATION_RUNTIME: "bedrock-data-automation-runtime",
603
+ BEDROCK_RUNTIME: "bedrock-runtime",
604
+ CHIME_SDK_IDENTITY: "identity-chime",
605
+ CHIME_SDK_MEDIA_PIPELINES: "media-pipelines-chime",
606
+ CHIME_SDK_MEETINGS: "meetings-chime",
607
+ CHIME_SDK_MESSAGING: "messaging-chime",
608
+ CHIME_SDK_VOICE: "voice-chime",
609
+ CLEANROOMSML: "cleanrooms-ml",
610
+ CLOUDCONTROL: "cloudcontrolapi",
611
+ CLOUDFRONT_KEYVALUESTORE: "cloudfront-keyvaluestore",
612
+ CLOUDTRAIL_DATA: "cloudtrail-data",
613
+ CLOUDWATCH: "monitoring",
614
+ CLOUDWATCHOMNI: "cloudwatch-omni",
615
+ CLOUDWATCH_LOGS: "logs",
616
+ CODEGURUPROFILER: "codeguru-profiler",
617
+ CODEGURU_REVIEWER: "codeguru-reviewer",
618
+ CODEGURU_SECURITY: "codeguru-security",
619
+ CODESTAR_CONNECTIONS: "codestar-connections",
620
+ CODESTAR_NOTIFICATIONS: "codestar-notifications",
621
+ COGNITO_IDENTITY: "cognito-identity",
622
+ COGNITO_IDENTITY_PROVIDER: "cognito-idp",
623
+ COGNITO_SYNC: "cognito-sync",
624
+ COMPUTE_OPTIMIZER: "compute-optimizer",
625
+ COMPUTE_OPTIMIZER_AUTOMATION: "aco-automation",
626
+ CONFIG_SERVICE: "config",
627
+ CONNECTCAMPAIGNS: "connect-campaigns",
628
+ CONNECTCAMPAIGNSV2: "connect-campaigns",
629
+ CONNECTCASES: "cases",
630
+ CONNECTHEALTH: "health-agent",
631
+ CONNECTPARTICIPANT: "participant.connect",
632
+ CONNECT_CONTACT_LENS: "contact-lens",
633
+ COST_AND_USAGE_REPORT_SERVICE: "cur",
634
+ COST_EXPLORER: "ce",
635
+ COST_OPTIMIZATION_HUB: "cost-optimization-hub",
636
+ CUSTOMER_PROFILES: "profile",
637
+ DATABASE_MIGRATION_SERVICE: "dms",
638
+ DETECTIVE: "api.detective",
639
+ DEVOPS_AGENT: "aidevops",
640
+ DEVOPS_GURU: "devops-guru",
641
+ DIRECTORY_SERVICE: "ds",
642
+ DIRECTORY_SERVICE_DATA: "ds-data",
643
+ DOCDB: "rds",
644
+ DOCDB_ELASTIC: "docdb-elastic",
645
+ DYNAMODB_STREAMS: "streams.dynamodb",
646
+ EC2_INSTANCE_CONNECT: "ec2-instance-connect",
647
+ ECR: "api.ecr",
648
+ ECR_PUBLIC: "api.ecr-public",
649
+ EFS: "elasticfilesystem",
650
+ EKS_AUTH: "eks-auth",
651
+ ELASTICSEARCH_SERVICE: "es",
652
+ ELASTIC_LOAD_BALANCING_V2: "elasticloadbalancing",
653
+ ELEMENTALINFERENCE: "elemental-inference",
654
+ EMR: "elasticmapreduce",
655
+ EMR_CONTAINERS: "emr-containers",
656
+ EMR_SERVERLESS: "emr-serverless",
657
+ ENDUSERMESSAGING: "end-user-messaging",
658
+ EVENTBRIDGE: "events",
659
+ EVENTBRIDGEV2: "eventsv2",
660
+ GEO_MAPS: "geo-maps",
661
+ GEO_PLACES: "geo-places",
662
+ GEO_ROUTES: "geo-routes",
663
+ GREENGRASSV2: "greengrass",
664
+ IAM_TOOLBOX: "iam-toolbox",
665
+ INSPECTOR_SCAN: "inspector-scan",
666
+ IOTDEVICEADVISOR: "api.iotdeviceadvisor",
667
+ IOTSECURETUNNELING: "api.tunneling.iot",
668
+ IOT_DATA_PLANE: "data-ats.iot",
669
+ IOT_JOBS_DATA_PLANE: "data.jobs.iot",
670
+ IOT_MANAGED_INTEGRATIONS: "api.iotmanagedintegrations",
671
+ IOT_WIRELESS: "api.iotwireless",
672
+ KENDRA_RANKING: "kendra-ranking",
673
+ KEYSPACES: "cassandra",
674
+ KEYSPACESSTREAMS: "cassandra-streams",
675
+ KINESIS_ANALYTICS_V2: "kinesisanalytics",
676
+ KINESIS_VIDEO_ARCHIVED_MEDIA: "kinesisvideo",
677
+ KINESIS_VIDEO_MEDIA: "kinesisvideo",
678
+ KINESIS_VIDEO_SIGNALING: "kinesisvideo",
679
+ KINESIS_VIDEO_WEBRTC_STORAGE: "kinesisvideo",
680
+ LAMBDA_CORE: "lambda",
681
+ LAMBDA_MICROVMS: "lambda",
682
+ LAMBDA_WEB: "lambda",
683
+ LEX_MODELS_V2: "models-v2-lex",
684
+ LEX_MODEL_BUILDING_SERVICE: "models.lex",
685
+ LEX_RUNTIME_SERVICE: "runtime.lex",
686
+ LEX_RUNTIME_V2: "runtime-v2-lex",
687
+ LICENSE_MANAGER: "license-manager",
688
+ LICENSE_MANAGER_LINUX_SUBSCRIPTIONS: "license-manager-linux-subscriptions",
689
+ LICENSE_MANAGER_USER_SUBSCRIPTIONS: "license-manager-user-subscriptions",
690
+ LOCATION: "geo",
691
+ MAILMANAGER: "mail-manager",
692
+ MANAGEDBLOCKCHAIN_QUERY: "managedblockchain-query",
693
+ MARKETPLACE_AGREEMENT: "agreement-marketplace",
694
+ MARKETPLACE_CATALOG: "catalog.marketplace",
695
+ MARKETPLACE_DEPLOYMENT: "deployment-marketplace",
696
+ MARKETPLACE_DISCOVERY: "discovery-marketplace",
697
+ MARKETPLACE_ENTITLEMENT_SERVICE: "entitlement.marketplace",
698
+ MARKETPLACE_METERING: "metering.marketplace",
699
+ MARKETPLACE_REPORTING: "reporting-marketplace",
700
+ MEDIAPACKAGE_VOD: "mediapackage-vod",
701
+ MEDIASTORE_DATA: "data.mediastore",
702
+ MEDIATAILOR: "api.mediatailor",
703
+ MEDICAL_IMAGING: "medical-imaging",
704
+ MEMORYDB: "memory-db",
705
+ MIGRATIONHUBORCHESTRATOR: "migrationhub-orchestrator",
706
+ MIGRATIONHUBSTRATEGY: "migrationhub-strategy",
707
+ MIGRATIONHUB_CONFIG: "migrationhub-config",
708
+ MIGRATION_HUB: "mgh",
709
+ MIGRATION_HUB_REFACTOR_SPACES: "refactor-spaces",
710
+ MTURK: "mturk-requester",
711
+ MWAA: "airflow",
712
+ MWAA_SERVERLESS: "airflow-serverless",
713
+ NEPTUNE: "rds",
714
+ NEPTUNEDATA: "neptune-db",
715
+ NEPTUNE_GRAPH: "neptune-graph",
716
+ NETWORK_FIREWALL: "network-firewall",
717
+ NETWORK_SECURITY_MANAGER: "network-security-manager",
718
+ NOTIFICATIONSCONTACTS: "notifications-contacts",
719
+ NOVA_ACT: "nova-act",
720
+ OPENSEARCH: "es",
721
+ OPENSEARCHSERVERLESS: "aoss",
722
+ PARTNERCENTRAL_ACCOUNT: "partnercentral-account",
723
+ PARTNERCENTRAL_BENEFITS: "partnercentral-benefits",
724
+ PARTNERCENTRAL_CHANNEL: "partnercentral-channel",
725
+ PARTNERCENTRAL_REVENUE_MEASUREMENT: "partnercentral-prm",
726
+ PARTNERCENTRAL_SELLING: "partnercentral-selling",
727
+ PAYMENT_CRYPTOGRAPHY: "controlplane.payment-cryptography",
728
+ PAYMENT_CRYPTOGRAPHY_DATA: "dataplane.payment-cryptography",
729
+ PCA_CONNECTOR_AD: "pca-connector-ad",
730
+ PCA_CONNECTOR_SCEP: "pca-connector-scep",
731
+ PERSONALIZE_EVENTS: "personalize-events",
732
+ PERSONALIZE_RUNTIME: "personalize-runtime",
733
+ PINPOINT_EMAIL: "email",
734
+ PINPOINT_SMS_VOICE: "sms-voice.pinpoint",
735
+ PINPOINT_SMS_VOICE_V2: "sms-voice",
736
+ PRICING: "api.pricing",
737
+ QAPPS: "data.qapps",
738
+ QCONNECT: "wisdom",
739
+ RDS_DATA: "rds-data",
740
+ REDSHIFT_DATA: "redshift-data",
741
+ REDSHIFT_SERVERLESS: "redshift-serverless",
742
+ RESILIENCEHUBV2: "resiliencehub",
743
+ RESOURCE_EXPLORER_2: "resource-explorer-2",
744
+ RESOURCE_GROUPS: "resource-groups",
745
+ RESOURCE_GROUPS_TAGGING_API: "tagging",
746
+ ROUTE53_RECOVERY_CLUSTER: "route53-recovery-cluster",
747
+ ROUTE53_RECOVERY_CONTROL_CONFIG: "route53-recovery-control-config",
748
+ ROUTE53_RECOVERY_READINESS: "route53-recovery-readiness",
749
+ S3OUTPOSTS: "s3-outposts",
750
+ S3_CONTROL: "s3-control",
751
+ SAGEMAKER: "api.sagemaker",
752
+ SAGEMAKERJOBRUNTIME: "job-runtime.sagemaker",
753
+ SAGEMAKERTRAININGSESSIONRUNTIME: "training-session-runtime.sagemaker",
754
+ SAGEMAKER_A2I_RUNTIME: "a2i-runtime.sagemaker",
755
+ SAGEMAKER_EDGE: "edge.sagemaker",
756
+ SAGEMAKER_FEATURESTORE_RUNTIME: "featurestore-runtime.sagemaker",
757
+ SAGEMAKER_GEOSPATIAL: "sagemaker-geospatial",
758
+ SAGEMAKER_METRICS: "metrics.sagemaker",
759
+ SAGEMAKER_RUNTIME: "runtime.sagemaker",
760
+ SECURITY_IR: "security-ir",
761
+ SERVERLESSAPPLICATIONREPOSITORY: "serverlessrepo",
762
+ SERVICE_CATALOG_APPREGISTRY: "servicecatalog-appregistry",
763
+ SES: "email",
764
+ SESV2: "email",
765
+ SFN: "states",
766
+ SIGNER_DATA: "data-signer",
767
+ SIMPLEDB: "sdb",
768
+ SIMPLEDBV2: "sdb",
769
+ SNOW_DEVICE_MANAGEMENT: "snow-device-management",
770
+ SOCIALMESSAGING: "social-messaging",
771
+ SSM_CONTACTS: "ssm-contacts",
772
+ SSM_GUICONNECT: "ssm-guiconnect",
773
+ SSM_INCIDENTS: "ssm-incidents",
774
+ SSM_QUICKSETUP: "ssm-quicksetup",
775
+ SSM_SAP: "ssm-sap",
776
+ SSO: "portal.sso",
777
+ SSO_ADMIN: "sso",
778
+ SSO_OIDC: "oidc",
779
+ SUPPLYCHAIN: "scn",
780
+ TAXSETTINGS: "tax",
781
+ TIMESTREAM_INFLUXDB: "timestream-influxdb",
782
+ TIMESTREAM_QUERY: "query.timestream",
783
+ TIMESTREAM_WRITE: "ingest.timestream",
784
+ VPC_LATTICE: "vpc-lattice",
785
+ WAF_REGIONAL: "waf-regional",
786
+ WICKR: "admin.wickr",
787
+ WORKSPACES_INSTANCES: "workspaces-instances",
788
+ WORKSPACES_THIN_CLIENT: "thinclient",
789
+ WORKSPACES_WEB: "workspaces-web"
790
+ };
791
+ const AWS_GLOBAL_ENDPOINTS = {
792
+ account: {
793
+ hostname: "account.us-east-1.amazonaws.com",
794
+ signingRegion: "us-east-1"
795
+ },
796
+ billingconductor: {
797
+ hostname: "billingconductor.us-east-1.amazonaws.com",
798
+ signingRegion: "us-east-1"
799
+ },
800
+ budgets: {
801
+ hostname: "budgets.amazonaws.com",
802
+ signingRegion: "us-east-1"
803
+ },
804
+ ce: {
805
+ hostname: "ce.us-east-1.amazonaws.com",
806
+ signingRegion: "us-east-1"
807
+ },
808
+ chime: {
809
+ hostname: "chime.us-east-1.amazonaws.com",
810
+ signingRegion: "us-east-1"
811
+ },
812
+ cloudfront: {
813
+ hostname: "cloudfront.amazonaws.com",
814
+ signingRegion: "us-east-1"
815
+ },
816
+ health: {
817
+ hostname: "global.health.amazonaws.com",
818
+ signingRegion: "us-east-1"
819
+ },
820
+ iam: {
821
+ hostname: "iam.amazonaws.com",
822
+ signingRegion: "us-east-1"
823
+ },
824
+ importexport: {
825
+ hostname: "importexport.amazonaws.com",
826
+ signingRegion: "us-east-1"
827
+ },
828
+ networkmanager: {
829
+ hostname: "networkmanager.us-west-2.amazonaws.com",
830
+ signingRegion: "us-west-2"
831
+ },
832
+ "notifications-contacts": {
833
+ hostname: "notifications-contacts.us-east-1.api.aws",
834
+ signingRegion: "us-east-1"
835
+ },
836
+ organizations: {
837
+ hostname: "organizations.us-east-1.amazonaws.com",
838
+ signingRegion: "us-east-1"
839
+ },
840
+ route53: {
841
+ hostname: "route53.amazonaws.com",
842
+ signingRegion: "us-east-1"
843
+ },
844
+ savingsplans: {
845
+ hostname: "savingsplans.amazonaws.com",
846
+ signingRegion: "us-east-1"
847
+ },
848
+ shield: {
849
+ hostname: "shield.us-east-1.amazonaws.com",
850
+ signingRegion: "us-east-1"
851
+ },
852
+ tax: {
853
+ hostname: "tax.us-east-1.amazonaws.com",
854
+ signingRegion: "us-east-1"
855
+ },
856
+ waf: {
857
+ hostname: "waf.amazonaws.com",
858
+ signingRegion: "us-east-1"
859
+ }
860
+ };
861
+
571
862
  //#endregion
572
863
  //#region src/local/aws-emulator-mixed-mode.ts
573
- const AWS_EMULATOR_SENTINEL = "aws-emulator";
864
+ const REAL_AWS_SENTINEL = "real-aws";
865
+ const LEGACY_AWS_EMULATOR_SENTINEL = "aws-emulator";
574
866
  const MIXED_MODE_RESIGN_PORT = 47297;
575
867
  const ENDPOINT_KEY = /^AWS_ENDPOINT_URL(?:_([A-Z0-9_]+))?$/;
576
- function isAwsEmulatorSentinel(key, value) {
577
- return typeof value === "string" && value.trim() === "aws-emulator" && ENDPOINT_KEY.test(key);
868
+ function isSentinel(key, value, sentinel) {
869
+ return typeof value === "string" && value.trim() === sentinel && ENDPOINT_KEY.test(key);
578
870
  }
579
- function findAwsEmulatorSentinels(overrides) {
871
+ function isRealAwsSentinel(key, value) {
872
+ return isSentinel(key, value, REAL_AWS_SENTINEL);
873
+ }
874
+ function isLegacyAwsEmulatorSentinel(key, value) {
875
+ return isSentinel(key, value, LEGACY_AWS_EMULATOR_SENTINEL);
876
+ }
877
+ function findSentinels(overrides, match) {
580
878
  const found = [];
581
879
  if (!overrides || typeof overrides !== "object") return found;
582
880
  for (const [section, map] of Object.entries(overrides)) {
583
881
  if (!map || typeof map !== "object" || Array.isArray(map)) continue;
584
882
  for (const [key, value] of Object.entries(map)) {
585
- if (!isAwsEmulatorSentinel(key, value)) continue;
883
+ if (!match(key, value)) continue;
586
884
  found.push({
587
885
  section,
588
886
  key,
@@ -592,33 +890,33 @@ function findAwsEmulatorSentinels(overrides) {
592
890
  }
593
891
  return found;
594
892
  }
893
+ function findRealAwsExceptions(overrides) {
894
+ return findSentinels(overrides, isRealAwsSentinel);
895
+ }
896
+ function findLegacyAwsEmulatorSentinels(overrides) {
897
+ return findSentinels(overrides, isLegacyAwsEmulatorSentinel);
898
+ }
595
899
  function readAwsEmulatorEnvVarsFile(filePath) {
596
- if (!filePath) return {
900
+ const none = {
597
901
  overrides: void 0,
598
- sentinels: []
902
+ exceptions: [],
903
+ legacySentinels: []
599
904
  };
905
+ if (!filePath) return none;
600
906
  let parsed;
601
907
  try {
602
908
  parsed = JSON.parse(readEnvVarsFileText(filePath));
603
909
  } catch {
604
- return {
605
- overrides: void 0,
606
- sentinels: []
607
- };
910
+ return none;
608
911
  }
609
- if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return {
610
- overrides: void 0,
611
- sentinels: []
612
- };
912
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return none;
613
913
  const overrides = parsed;
614
914
  return {
615
915
  overrides,
616
- sentinels: findAwsEmulatorSentinels(overrides)
916
+ exceptions: findRealAwsExceptions(overrides),
917
+ legacySentinels: findLegacyAwsEmulatorSentinels(overrides)
617
918
  };
618
919
  }
619
- function readAwsEmulatorSentinelsFromFile(filePath) {
620
- return readAwsEmulatorEnvVarsFile(filePath).sentinels;
621
- }
622
920
  function sectionAppliesTo(section, workload) {
623
921
  if (section === "Parameters") return false;
624
922
  if (workload.logicalId !== void 0 && section === workload.logicalId) return true;
@@ -626,14 +924,14 @@ function sectionAppliesTo(section, workload) {
626
924
  const path = workload.cdkPath;
627
925
  return path !== void 0 && (path === section || path.startsWith(`${section}/`));
628
926
  }
629
- function emulatedServicesForWorkload(overrides, workload) {
927
+ function realAwsServicesForWorkload(overrides, workload) {
630
928
  const out = /* @__PURE__ */ new Set();
631
929
  const apply = (map) => {
632
930
  if (!map || typeof map !== "object" || Array.isArray(map)) return;
633
931
  for (const [key, value] of Object.entries(map)) {
634
932
  const service = ENDPOINT_KEY.exec(key)?.[1];
635
933
  if (service === void 0) continue;
636
- if (isAwsEmulatorSentinel(key, value)) out.add(service);
934
+ if (isRealAwsSentinel(key, value)) out.add(service);
637
935
  else if (value === null || [
638
936
  "string",
639
937
  "number",
@@ -650,21 +948,39 @@ function correctServiceIdSpelling(service) {
650
948
  const bare = service.replace(/_/g, "");
651
949
  for (const id of AWS_ENDPOINT_SERVICE_IDS) if (id.replace(/_/g, "") === bare) return id;
652
950
  }
653
- function validateAwsEmulatorSentinels(sentinels, awsEmulatorOn, envVarName = "CDK_LOCAL_AWS_EMULATOR") {
654
- const first = sentinels[0];
655
- if (!first) return;
656
- const where = (s) => `${s.key} under ${displayUntrustedValue(s.section)}`;
657
- const bare = sentinels.find((s) => s.service === "");
658
- if (bare) throw new Error(`--env-vars sets ${where(bare)} to "${AWS_EMULATOR_SENTINEL}", but the sentinel routes ONE service (AWS_ENDPOINT_URL_<SERVICE>). To send every service to AWS Emulator, use --aws-emulator without a sentinel.`);
659
- const unknown = sentinels.find((s) => !AWS_ENDPOINT_SERVICE_IDS.has(s.service));
951
+ function legacyAwsEmulatorSentinelMessage(s) {
952
+ return `--env-vars sets ${s.key} under ${displayUntrustedValue(s.section)} to "${LEGACY_AWS_EMULATOR_SENTINEL}", which is no longer supported: --aws-emulator now sends EVERY service to AWS Emulator, and the --env-vars file marks only the exceptions that must reach real AWS, with "${REAL_AWS_SENTINEL}". Remove the "${LEGACY_AWS_EMULATOR_SENTINEL}" entries, and mark each service that must stay on real AWS instead, e.g. "AWS_ENDPOINT_URL_SECRETS_MANAGER": "${REAL_AWS_SENTINEL}".`;
953
+ }
954
+ function validateAwsEmulatorEnvVars(scan, awsEmulatorOn) {
955
+ const legacy = scan.legacySentinels[0];
956
+ if (legacy) throw new Error(legacyAwsEmulatorSentinelMessage(legacy));
957
+ if (!awsEmulatorOn) return;
958
+ if (scan.exceptions.some((s) => s.service === "")) throw new Error(`--env-vars: "AWS_ENDPOINT_URL": "${REAL_AWS_SENTINEL}" would send every AWS call to real AWS, which is what running without --aws-emulator does. Remove --aws-emulator to run against real AWS, or keep it and mark only the services that must reach real AWS, e.g. "AWS_ENDPOINT_URL_SECRETS_MANAGER": "${REAL_AWS_SENTINEL}".`);
959
+ const unknown = scan.exceptions.find((s) => !AWS_ENDPOINT_SERVICE_IDS.has(s.service));
660
960
  if (unknown) {
661
961
  const fix = correctServiceIdSpelling(unknown.service);
662
- throw new Error(`--env-vars sets ${where(unknown)} to "${AWS_EMULATOR_SENTINEL}", but the AWS SDKs do not read ${unknown.key}, so the workload's calls would still go to real AWS. ` + (fix ? `Use AWS_ENDPOINT_URL_${fix}.` : "The suffix must be the service's SDK endpoint id (its serviceId, uppercased, spaces as underscores)."));
962
+ throw new Error(`--env-vars sets ${unknown.key} under ${displayUntrustedValue(unknown.section)} to "${REAL_AWS_SENTINEL}", but the AWS SDKs do not read ${unknown.key}, so the workload's calls would still go to AWS Emulator. ` + (fix ? `Use AWS_ENDPOINT_URL_${fix}.` : "The suffix must be the service's SDK endpoint id (its serviceId, uppercased, spaces as underscores)."));
663
963
  }
664
- if (!awsEmulatorOn) throw new Error(`--env-vars sets ${where(first)} to "${AWS_EMULATOR_SENTINEL}", which needs --aws-emulator [url] (or ${envVarName}) to name the AWS Emulator to route it to.`);
665
964
  }
666
- function emulatedServicesOf(sentinels) {
667
- return [...new Set(sentinels.map((s) => s.service).filter((s) => s !== ""))].sort();
965
+ function realAwsServicesOf(exceptions) {
966
+ return [...new Set(exceptions.map((s) => s.service).filter((s) => s !== ""))].sort();
967
+ }
968
+ const NO_REGIONAL_ENDPOINT = /* @__PURE__ */ new Set(["APIGATEWAYMANAGEMENTAPI", "CLOUDFRONT_KEYVALUESTORE"]);
969
+ const REGION_SHAPE = /^[a-z]{2}(-[a-z]+)+-\d+$/;
970
+ function realAwsEndpointFor(service, region) {
971
+ if (!REGION_SHAPE.test(region)) throw new Error(`--env-vars marks AWS_ENDPOINT_URL_${service} "${REAL_AWS_SENTINEL}", but the workload's region ${displayUntrustedValue(region)} is not an AWS region name.`);
972
+ if (NO_REGIONAL_ENDPOINT.has(service)) throw new Error(`--env-vars marks AWS_ENDPOINT_URL_${service} "${REAL_AWS_SENTINEL}", but ${service} has no regional endpoint to name. Set AWS_ENDPOINT_URL_${service} to the real endpoint URL instead (a literal URL is passed through as-is).`);
973
+ const prefix = AWS_ENDPOINT_PREFIX_OVERRIDES[service] ?? service.toLowerCase().replace(/_/g, "");
974
+ const isolated = /^(us|eu)-iso[a-z]*-/.test(region);
975
+ const china = region.startsWith("cn-");
976
+ const gov = region.startsWith("us-gov-");
977
+ const global = AWS_GLOBAL_ENDPOINTS[prefix];
978
+ if (isolated || global && (china || gov)) throw new Error(`--env-vars marks AWS_ENDPOINT_URL_${service} "${REAL_AWS_SENTINEL}", but ${displayUntrustedValue(region)} has no known real ${service} endpoint. Set AWS_ENDPOINT_URL_${service} to the real endpoint URL instead (a literal URL is passed through as-is).`);
979
+ if (global) {
980
+ if (global.signingRegion !== region) throw new Error(`--env-vars marks AWS_ENDPOINT_URL_${service} "${REAL_AWS_SENTINEL}", but ${service} is served by one global endpoint (https://${global.hostname}) that accepts only requests signed for ${global.signingRegion}, and an SDK signs a request to an explicit endpoint for the workload's region (${displayUntrustedValue(region)}), which that endpoint refuses. Leave ${service} on AWS Emulator, or run the workload in ${global.signingRegion}.`);
981
+ return `https://${global.hostname}`;
982
+ }
983
+ return `https://${prefix}.${region}.${china ? "amazonaws.com.cn" : "amazonaws.com"}`;
668
984
  }
669
985
  const SERVICE_NAMESPACE_ALIASES = {
670
986
  EVENTBRIDGE: ["EVENTS"],
@@ -676,7 +992,7 @@ const SERVICE_NAMESPACE_ALIASES = {
676
992
  OPENSEARCH: ["OPENSEARCHSERVICE"],
677
993
  ELASTICSEARCHSERVICE: ["ELASTICSEARCH"]
678
994
  };
679
- function resourceTypeMatchesEmulatedService(resourceType, services) {
995
+ function resourceTypeMatchesService(resourceType, services) {
680
996
  const ns = /^AWS::([A-Za-z0-9]+)::/.exec(resourceType)?.[1]?.toUpperCase();
681
997
  if (!ns) return false;
682
998
  return services.some((s) => {
@@ -686,71 +1002,71 @@ function resourceTypeMatchesEmulatedService(resourceType, services) {
686
1002
  }
687
1003
  const MISSING_LIST_LIMIT = 10;
688
1004
  function createMixedModeStateProvider(opts) {
689
- const { real, emulator, emulatedServices } = opts;
1005
+ const { real, emulator, realServices } = opts;
690
1006
  const swaps = /* @__PURE__ */ new Map();
1007
+ const toReal = /* @__PURE__ */ new Map();
691
1008
  const warned = /* @__PURE__ */ new Set();
692
- const warnedReal = /* @__PURE__ */ new Set();
1009
+ const warnedEmulator = /* @__PURE__ */ new Set();
693
1010
  const swap = (v) => swaps.get(v) ?? v;
1011
+ const excepted = (res) => resourceTypeMatchesService(res.resourceType, realServices);
694
1012
  const provider = {
695
- label: real.label,
1013
+ label: emulator.label,
696
1014
  async load(stackName, synthRegion) {
697
- const [r, e] = await Promise.all([real.load(stackName, synthRegion), emulator.load(stackName, synthRegion)]);
698
- if (!e) {
699
- if (r && !warned.has(stackName)) {
700
- if (Object.values(r.resources).some((res) => resourceTypeMatchesEmulatedService(res.resourceType, emulatedServices))) {
701
- warned.add(stackName);
702
- const why = emulator.getLastLoadError?.();
703
- getLogger().warn(`${real.label}: stack ${displayUntrustedValue(stackName)} could not be read from AWS Emulator${why ? ` (${why})` : ""}; resources of the emulated services (${emulatedServices.join(", ")}) keep their real AWS names. Override them with --env-vars, or deploy the stack into the emulator.`);
704
- }
1015
+ const [e, r] = await Promise.all([emulator.load(stackName, synthRegion), real.load(stackName, synthRegion)]);
1016
+ if (!r) {
1017
+ if (e && !warned.has(stackName) && Object.values(e.resources).some(excepted)) {
1018
+ warned.add(stackName);
1019
+ const why = real.getLastLoadError?.();
1020
+ getLogger().warn(`${emulator.label}: stack ${displayUntrustedValue(stackName)} could not be read from real AWS${why ? ` (${why})` : ""}; resources of the services marked "${REAL_AWS_SENTINEL}" (${realServices.join(", ")}) keep their AWS Emulator names. Override them with --env-vars, or deploy the stack to real AWS too.`);
705
1021
  }
706
- return r;
1022
+ return e;
707
1023
  }
708
- const emulated = (res) => resourceTypeMatchesEmulatedService(res.resourceType, emulatedServices);
709
- if (!r) {
1024
+ if (!e) {
710
1025
  const resources = {};
711
1026
  const dropped = [];
712
- for (const [id, res] of Object.entries(e.resources)) if (emulated(res)) resources[id] = res;
1027
+ for (const [id, res] of Object.entries(r.resources)) if (excepted(res)) resources[id] = res;
713
1028
  else dropped.push(`${displayUntrustedValue(id)} (${displayUntrustedValue(res.resourceType)})`);
714
- if (dropped.length > 0 && !warnedReal.has(stackName)) {
715
- warnedReal.add(stackName);
716
- const why = real.getLastLoadError?.();
1029
+ if (dropped.length > 0 && !warnedEmulator.has(stackName)) {
1030
+ warnedEmulator.add(stackName);
1031
+ const why = emulator.getLastLoadError?.();
717
1032
  const shown = dropped.slice(0, MISSING_LIST_LIMIT).join(", ");
718
1033
  const more = dropped.length > MISSING_LIST_LIMIT ? ` and ${dropped.length - MISSING_LIST_LIMIT} more` : "";
719
- getLogger().warn(`${real.label}: stack ${displayUntrustedValue(stackName)} could not be read from real AWS${why ? ` (${why})` : ""}, only from AWS Emulator; resources outside the emulated services (${emulatedServices.join(", ")}) stay unresolved: ${shown}${more}. Deploy the stack to real AWS too, under the same stack name (the same CDK context, e.g. -c stage=dev), or override them with --env-vars.`);
1034
+ getLogger().warn(`${emulator.label}: stack ${displayUntrustedValue(stackName)} could not be read from AWS Emulator${why ? ` (${why})` : ""}, only from real AWS; resources outside the services marked "${REAL_AWS_SENTINEL}" (${realServices.join(", ")}) stay unresolved: ${shown}${more}. Deploy the stack into AWS Emulator under the same stack name (the same CDK context, e.g. -c stage=dev), or override them with --env-vars.`);
720
1035
  }
721
1036
  return {
722
1037
  resources,
723
- outputs: { ...e.outputs },
724
- region: e.region
1038
+ outputs: {},
1039
+ region: r.region
725
1040
  };
726
1041
  }
727
- const resources = { ...r.resources };
728
- for (const [id, res] of Object.entries(e.resources)) {
729
- if (!emulated(res)) continue;
730
- const realRes = r.resources[id];
731
- if (realRes?.physicalId && res.physicalId && realRes.physicalId !== res.physicalId) swaps.set(realRes.physicalId, res.physicalId);
1042
+ const resources = { ...e.resources };
1043
+ for (const [id, res] of Object.entries(r.resources)) {
1044
+ const emuId = e.resources[id]?.physicalId;
1045
+ if (emuId && res.physicalId) toReal.set(emuId, res.physicalId);
1046
+ if (!excepted(res)) continue;
1047
+ const emuRes = e.resources[id];
1048
+ if (emuRes?.physicalId && res.physicalId && emuRes.physicalId !== res.physicalId) swaps.set(emuRes.physicalId, res.physicalId);
732
1049
  resources[id] = res;
733
1050
  }
734
1051
  const outputs = {};
735
- for (const [k, v] of Object.entries(e.outputs)) outputs[k] = v;
736
- for (const [k, v] of Object.entries(r.outputs)) outputs[k] = swap(v);
1052
+ for (const [k, v] of Object.entries(e.outputs)) outputs[k] = swap(v);
737
1053
  return {
738
1054
  resources,
739
1055
  outputs,
740
- region: r.region
1056
+ region: e.region
741
1057
  };
742
1058
  },
743
- buildCrossStackResolver: (region) => real.buildCrossStackResolver(region),
1059
+ buildCrossStackResolver: (region) => emulator.buildCrossStackResolver(region),
744
1060
  dispose() {
745
1061
  try {
746
- real.dispose();
747
- } finally {
748
1062
  emulator.dispose();
1063
+ } finally {
1064
+ real.dispose();
749
1065
  }
750
1066
  }
751
1067
  };
752
- if (real.resolveDeployedFunctionEnv) {
753
- const fn = real.resolveDeployedFunctionEnv.bind(real);
1068
+ if (emulator.resolveDeployedFunctionEnv) {
1069
+ const fn = emulator.resolveDeployedFunctionEnv.bind(emulator);
754
1070
  provider.resolveDeployedFunctionEnv = async (id) => {
755
1071
  const env = await fn(id);
756
1072
  if (!env) return env;
@@ -759,10 +1075,16 @@ function createMixedModeStateProvider(opts) {
759
1075
  return out;
760
1076
  };
761
1077
  }
762
- if (real.resolveLambdaExecutionRoleArn) provider.resolveLambdaExecutionRoleArn = real.resolveLambdaExecutionRoleArn.bind(real);
763
- if (real.resolveAgentCoreRuntimeRoleArn) provider.resolveAgentCoreRuntimeRoleArn = real.resolveAgentCoreRuntimeRoleArn.bind(real);
1078
+ if (real.resolveLambdaExecutionRoleArn) {
1079
+ const fn = real.resolveLambdaExecutionRoleArn.bind(real);
1080
+ provider.resolveLambdaExecutionRoleArn = (id) => fn(toReal.get(id) ?? id);
1081
+ }
1082
+ if (real.resolveAgentCoreRuntimeRoleArn) {
1083
+ const fn = real.resolveAgentCoreRuntimeRoleArn.bind(real);
1084
+ provider.resolveAgentCoreRuntimeRoleArn = (id) => fn(toReal.get(id) ?? id);
1085
+ }
764
1086
  if (real.resolveTemplateSsmParameters) provider.resolveTemplateSsmParameters = real.resolveTemplateSsmParameters.bind(real);
765
- if (real.getLastLoadError) provider.getLastLoadError = real.getLastLoadError.bind(real);
1087
+ if (emulator.getLastLoadError) provider.getLastLoadError = emulator.getLastLoadError.bind(emulator);
766
1088
  return provider;
767
1089
  }
768
1090
 
@@ -858,25 +1180,26 @@ function normalizeAwsEndpointServiceId(serviceId) {
858
1180
  }
859
1181
  function setAwsEmulatorServiceRouting(r) {
860
1182
  serviceRouting = r ? {
861
- services: new Set(r.services.map(normalizeAwsEndpointServiceId)),
1183
+ realServices: new Set(r.realServices.map(normalizeAwsEndpointServiceId)),
862
1184
  override: r.override,
863
1185
  envOverrides: r.envOverrides
864
1186
  } : void 0;
865
1187
  }
866
1188
  function getAwsEmulatorServiceRouting() {
867
1189
  return serviceRouting ? {
868
- services: [...serviceRouting.services].sort(),
1190
+ realServices: [...serviceRouting.realServices].sort(),
869
1191
  override: serviceRouting.override,
870
1192
  ...serviceRouting.envOverrides && { envOverrides: serviceRouting.envOverrides }
871
1193
  } : void 0;
872
1194
  }
873
- function awsEmulatorRoutedServices(workload) {
1195
+ function awsEmulatorRealServices(workload) {
874
1196
  if (!serviceRouting) return void 0;
875
- if (workload === void 0 || serviceRouting.envOverrides === void 0) return [...serviceRouting.services].sort();
876
- return emulatedServicesForWorkload(serviceRouting.envOverrides, workload);
1197
+ if (serviceRouting.envOverrides === void 0) return [...serviceRouting.realServices].sort();
1198
+ return realAwsServicesForWorkload(serviceRouting.envOverrides, workload ?? {});
877
1199
  }
878
1200
  function mixedModeRoutes(serviceId, workload) {
879
- return awsEmulatorRoutedServices(workload)?.includes(normalizeAwsEndpointServiceId(serviceId)) ?? false;
1201
+ const real = awsEmulatorRealServices(workload);
1202
+ return real !== void 0 && !real.includes(normalizeAwsEndpointServiceId(serviceId));
880
1203
  }
881
1204
  function isAwsServiceRoutedToEmulator(serviceId, workload) {
882
1205
  if (endpointOverride) return true;
@@ -891,6 +1214,13 @@ function awsClientConfigForService(serviceId, opts = {}) {
891
1214
  function awsEndpointOverrideClientConfig(o) {
892
1215
  return endpointOverrideClientConfig(o);
893
1216
  }
1217
+ function deployArtifactsReadEmulator() {
1218
+ return endpointOverride !== void 0 || serviceRouting !== void 0;
1219
+ }
1220
+ function deployArtifactClientConfig(opts = {}) {
1221
+ if (!endpointOverride && serviceRouting) return endpointOverrideClientConfig(serviceRouting.override);
1222
+ return buildProxyClientConfig(opts);
1223
+ }
894
1224
  function endpointOverrideClientConfig(o) {
895
1225
  const httpsAgent = new Agent$1({
896
1226
  keepAlive: true,
@@ -1500,6 +1830,7 @@ var workload_aws_wiring_exports = /* @__PURE__ */ __exportAll({
1500
1830
  collectHostEndpointOverrides: () => collectHostEndpointOverrides,
1501
1831
  displayEndpointValue: () => displayEndpointValue,
1502
1832
  effectiveLoopbackPorts: () => effectiveLoopbackPorts,
1833
+ envKeepsRealAwsException: () => envKeepsRealAwsException,
1503
1834
  getActiveWorkloadAwsWiring: () => getActiveWorkloadAwsWiring,
1504
1835
  getContainerCaBundlePath: () => getContainerCaBundlePath,
1505
1836
  getContainerJavaTruststorePath: () => getContainerJavaTruststorePath,
@@ -1516,6 +1847,8 @@ var workload_aws_wiring_exports = /* @__PURE__ */ __exportAll({
1516
1847
  resolveWorkloadAwsWiring: () => resolveWorkloadAwsWiring,
1517
1848
  setActiveWorkloadAwsWiring: () => setActiveWorkloadAwsWiring,
1518
1849
  sweepStaleResignDirs: () => sweepStaleResignDirs,
1850
+ takeAwsEmulatorStateSourceHint: () => takeAwsEmulatorStateSourceHint,
1851
+ workloadGetsEmulatorKeysOnly: () => workloadGetsEmulatorKeysOnly,
1519
1852
  writeCaBundleFile: () => writeCaBundleFile
1520
1853
  });
1521
1854
  const CA_TRUST_ENV_KEYS = [
@@ -1795,6 +2128,7 @@ function processAlive(pid) {
1795
2128
  }
1796
2129
  function resolveMixedModeWiring(args) {
1797
2130
  const { ep, services, credentials, caSources, disposers } = args;
2131
+ const resignEndpoint = `https://127.0.0.1:${MIXED_MODE_RESIGN_PORT}`;
1798
2132
  const caPems = [];
1799
2133
  for (const source of caSources) try {
1800
2134
  caPems.push(...pemCertificates(readFileSync(source, "utf8")));
@@ -1834,10 +2168,12 @@ function resolveMixedModeWiring(args) {
1834
2168
  return {
1835
2169
  mode: "forward",
1836
2170
  mixed: {
1837
- services,
2171
+ realServices: services,
1838
2172
  emulatorEndpoint: ep,
1839
2173
  resignPort: MIXED_MODE_RESIGN_PORT,
1840
- resignEndpoint: `https://127.0.0.1:${MIXED_MODE_RESIGN_PORT}`,
2174
+ resignEndpoint,
2175
+ emulatorCredentials: config.credentials,
2176
+ ...args.region ? { region: args.region } : {},
1841
2177
  resignConfigHostPath,
1842
2178
  emulatorClientOverride: {
1843
2179
  endpoint: ep.url,
@@ -1845,7 +2181,12 @@ function resolveMixedModeWiring(args) {
1845
2181
  credentials: config.credentials
1846
2182
  }
1847
2183
  },
1848
- env: trust,
2184
+ env: {
2185
+ AWS_ENDPOINT_URL: resignEndpoint,
2186
+ AWS_EC2_METADATA_DISABLED: "true",
2187
+ AWS_DISABLE_HOST_PREFIX_INJECTION: "true",
2188
+ ...trust
2189
+ },
1849
2190
  scrubEnvKeys: [],
1850
2191
  mounts: [{
1851
2192
  hostPath: bundle.hostPath,
@@ -1891,7 +2232,7 @@ async function resolveWorkloadAwsWiring(opts) {
1891
2232
  }
1892
2233
  const run = readEmulatorRunFiles(ep.port, homeDir);
1893
2234
  const caSource = opts.caBundle || run.caPath || env["AWS_CA_BUNDLE"];
1894
- const mixedServices = emulatedServicesOf(opts.awsEmulatorSentinels ?? []);
2235
+ const mixedServices = realAwsServicesOf(opts.realAwsExceptions ?? []);
1895
2236
  const probeCa = mixedServices.length > 0 ? run.caPath || caSource : caSource;
1896
2237
  const failure = await (opts.probeHealth ?? probeAwsEmulatorHealth)(ep.url, probeCa ? expandHome(probeCa, homeDir) : void 0);
1897
2238
  if (failure) throw new Error(describeEmulatorUnreachable(ep, failure));
@@ -1943,6 +2284,7 @@ async function resolveWorkloadAwsWiring(opts) {
1943
2284
  AWS_ENDPOINT_URL: ep.url,
1944
2285
  AWS_EC2_METADATA_DISABLED: "true",
1945
2286
  AWS_DISABLE_HOST_PREFIX_INJECTION: "true",
2287
+ AWS_IGNORE_CONFIGURED_ENDPOINT_URLS: "false",
1946
2288
  ...ca?.env ?? {},
1947
2289
  ...java?.env ?? {}
1948
2290
  },
@@ -2023,10 +2365,24 @@ function applyWorkloadAwsWiringToEnv(env, wiring, defaultCredentials) {
2023
2365
  configurable: true,
2024
2366
  writable: true
2025
2367
  });
2368
+ let keepsException = false;
2026
2369
  for (const [k, v] of Object.entries(out)) {
2027
- if (!isAwsEmulatorSentinel(k, v)) continue;
2028
- if (!wiring.mixed || k === "AWS_ENDPOINT_URL") throw new Error(`${k}="${AWS_EMULATOR_SENTINEL}" reached a workload container outside mixed mode. The sentinel is read from the --env-vars file, on an AWS_ENDPOINT_URL_<SERVICE> variable, and needs --aws-emulator [url].`);
2029
- out[k] = wiring.mixed.resignEndpoint;
2370
+ if (isLegacyAwsEmulatorSentinel(k, v)) throw new Error(legacyAwsEmulatorSentinelMessage({
2371
+ section: "the container env",
2372
+ key: k,
2373
+ service: ""
2374
+ }));
2375
+ if (!isRealAwsSentinel(k, v)) continue;
2376
+ if (wiring.mode === "forward" && !wiring.mixed) {
2377
+ getLogger().debug(`${k}="${REAL_AWS_SENTINEL}" without --aws-emulator: dropped (a no-op).`);
2378
+ delete out[k];
2379
+ continue;
2380
+ }
2381
+ if (!wiring.mixed || k === "AWS_ENDPOINT_URL") throw new Error(`${k}="${REAL_AWS_SENTINEL}" reached a workload container under --aws-emulator without mixed-mode wiring. Mark exceptions in the --env-vars file, on an AWS_ENDPOINT_URL_<SERVICE> variable.`);
2382
+ const region = out["AWS_REGION"] || out["AWS_DEFAULT_REGION"] || wiring.mixed.region;
2383
+ if (!region) throw new Error(`${k}="${REAL_AWS_SENTINEL}" needs the workload's region to name the real endpoint, and none is set. Pass --region, or set AWS_REGION.`);
2384
+ out[k] = realAwsEndpointFor(k.slice(17), region);
2385
+ keepsException = true;
2030
2386
  }
2031
2387
  const setCreds = (c) => {
2032
2388
  for (const k of CREDENTIAL_KEYS) delete out[k];
@@ -2042,13 +2398,27 @@ function applyWorkloadAwsWiringToEnv(env, wiring, defaultCredentials) {
2042
2398
  const javaToolOptions = wiring.env["JAVA_TOOL_OPTIONS"];
2043
2399
  if (javaToolOptions !== void 0) out["JAVA_TOOL_OPTIONS"] = mergeJavaToolOptions(ownJavaToolOptions, javaToolOptions);
2044
2400
  setCreds(wiring.emulatorCredentials);
2401
+ } else if (wiring.mixed && !keepsException) {
2402
+ for (const k of EMULATOR_SCRUBBED_ENV_KEYS) delete out[k];
2403
+ delete out["AWS_CONTAINER_CREDENTIALS_RELATIVE_URI"];
2404
+ out["AWS_IGNORE_CONFIGURED_ENDPOINT_URLS"] = "false";
2405
+ for (const [k, v] of Object.entries(wiring.env)) if (out[k] === void 0) out[k] = v;
2406
+ setCreds(wiring.mixed.emulatorCredentials);
2045
2407
  } else {
2408
+ if (wiring.mixed) out["AWS_IGNORE_CONFIGURED_ENDPOINT_URLS"] = "false";
2046
2409
  for (const [k, v] of Object.entries(wiring.env)) if (out[k] === void 0) out[k] = v;
2047
2410
  if (defaultCredentials && !out["AWS_ACCESS_KEY_ID"]) setCreds(defaultCredentials);
2048
2411
  }
2049
2412
  if (out["AWS_REGION"] && !out["AWS_DEFAULT_REGION"]) out["AWS_DEFAULT_REGION"] = out["AWS_REGION"];
2050
2413
  return out;
2051
2414
  }
2415
+ function envKeepsRealAwsException(env) {
2416
+ return Object.entries(env).some(([k, v]) => k !== "AWS_ENDPOINT_URL" && isRealAwsSentinel(k, v));
2417
+ }
2418
+ function workloadGetsEmulatorKeysOnly(env, wiring) {
2419
+ if (!wiring) return false;
2420
+ return wiring.mode === "emulator" || wiring.mixed !== void 0 && !envKeepsRealAwsException(env);
2421
+ }
2052
2422
  async function resolveHostDefaultCredentials(opts = {}) {
2053
2423
  const name = assumedRoleRecorded() ? profileName(process.env, opts.profile) : opts.profile;
2054
2424
  const key = `${assumedRoleRecorded() ? "noenv" : "chain"}:${name ?? ""}`;
@@ -2107,24 +2477,25 @@ function resolveAwsEmulatorOption(flag, env = process.env) {
2107
2477
  }
2108
2478
  async function activateWorkloadAwsWiring(options) {
2109
2479
  const awsEmulator = resolveAwsEmulatorOption(options.awsEmulator);
2110
- const { overrides, sentinels } = readAwsEmulatorEnvVarsFile(options.envVars);
2111
- validateAwsEmulatorSentinels(sentinels, awsEmulator !== void 0, awsEmulatorEnvName());
2480
+ const scan = readAwsEmulatorEnvVarsFile(options.envVars);
2481
+ validateAwsEmulatorEnvVars(scan, awsEmulator !== void 0);
2482
+ const { overrides } = scan;
2112
2483
  const wiring = await resolveWorkloadAwsWiring({
2113
2484
  awsEmulator,
2114
2485
  caBundle: options.caBundle,
2115
2486
  profile: options.profile,
2116
2487
  skipPull: options.pull === false,
2117
- awsEmulatorSentinels: sentinels
2488
+ ...awsEmulator !== void 0 && { realAwsExceptions: scan.exceptions }
2118
2489
  });
2119
2490
  setActiveWorkloadAwsWiring(wiring);
2120
2491
  if (wiring.mixed) {
2121
2492
  setAwsEndpointOverride(void 0);
2122
2493
  setAwsEmulatorServiceRouting({
2123
- services: wiring.mixed.services,
2494
+ realServices: wiring.mixed.realServices,
2124
2495
  override: wiring.mixed.emulatorClientOverride,
2125
2496
  envOverrides: overrides
2126
2497
  });
2127
- getLogger().info(`Mixed mode: ${wiring.mixed.services.join(", ")} go to AWS Emulator at ${wiring.mixed.emulatorEndpoint.url} (signed with its keys), for the workload and for ${getEmbedConfig().productName}'s own calls; every other AWS call uses your real credentials.`);
2498
+ getLogger().info(`Mixed mode: every AWS call goes to AWS Emulator at ${wiring.mixed.emulatorEndpoint.url} (signed with its keys) except ${wiring.mixed.realServices.join(", ")}, which go to real AWS with your real credentials, for the workload and for ${getEmbedConfig().productName}'s own calls.`);
2128
2499
  } else if (wiring.mode === "emulator" && wiring.emulatorEndpoint) {
2129
2500
  setAwsEmulatorServiceRouting(void 0);
2130
2501
  setAwsEndpointOverride({
@@ -2139,6 +2510,14 @@ async function activateWorkloadAwsWiring(options) {
2139
2510
  }
2140
2511
  return wiring;
2141
2512
  }
2513
+ let stateSourceHintShown = false;
2514
+ function takeAwsEmulatorStateSourceHint() {
2515
+ const wiring = active;
2516
+ if (stateSourceHintShown || !wiring || wiring.mode !== "emulator" && !wiring.mixed) return;
2517
+ stateSourceHintShown = true;
2518
+ const { cliName } = getEmbedConfig();
2519
+ return `Under --aws-emulator, the environment variables above that reference a resource need deployed names: pass ${cliName === "cdkl" ? "a host CLI's --from-state (the stack deployed into AWS Emulator with that host's own deploy)" : `--from-state (the stack deployed into AWS Emulator with \`${cliName} deploy --aws-emulator\`)`}, or --from-cfn-stack (the stack deployed into AWS Emulator with \`cdk deploy\`), or set the values with --env-vars.`;
2520
+ }
2142
2521
 
2143
2522
  //#endregion
2144
2523
  //#region src/utils/workload-identity.ts
@@ -2264,6 +2643,10 @@ function deployAccountStsClientConfig(args) {
2264
2643
  };
2265
2644
  }
2266
2645
  function accountLookupStsClientConfig(args) {
2646
+ if (getAwsEmulatorServiceRouting() && isAwsServiceRoutedToEmulator("STS")) return {
2647
+ ...buildProxyClientConfig({ service: "STS" }),
2648
+ ...args.region && { region: args.region }
2649
+ };
2267
2650
  return args.readFromCfnStack ? workloadStsClientConfig({
2268
2651
  region: args.region,
2269
2652
  profile: args.profile
@@ -2296,5 +2679,5 @@ function warnWorkloadCredentialsStripped() {
2296
2679
  }
2297
2680
 
2298
2681
  //#endregion
2299
- export { setAwsEmulatorServiceRouting as $, parseAwsEndpoint as A, MIXED_MODE_RESIGN_BODY_CAP_BYTES as B, effectiveLoopbackPorts as C, javaTruststoreToolOptions as D, getContainerJavaTruststorePath as E, resolveHostDefaultCredentials as F, awsEndpointOverrideClientConfig as G, createMixedModeTlsMaterials as H, resolveWorkloadAwsWiring as I, getAwsEndpointOverride as J, buildProxyClientConfig as K, setActiveWorkloadAwsWiring as L, readEmulatorRunFiles as M, readProfileEndpointSettings as N, loopbackForwarderPlan as O, resolveAwsEmulatorOption as P, proxyAwareFetch as Q, workload_aws_wiring_exports as R, displayEndpointValue as S, getContainerCaBundlePath as T, awsClientConfigForService as U, RESIGN_SIDECAR_SCRIPT as V, awsEmulatorRoutedServices as W, isProxyEnvConfigured as X, isAwsServiceRoutedToEmulator as Y, normalizeAwsEndpointServiceId as Z, HOST_DEFAULT_CREDENTIALS_MISS_TTL_MS as _, isLoopbackHostname as _t, deployAccountStsClientConfig as a, emulatedServicesOf as at, awsEmulatorEnvName as b, formatHostForAuthority as bt, resetWorkloadIdentity as c, readAwsEmulatorEnvVarsFile as ct, workloadStsClientConfig as d, validateAwsEmulatorSentinels as dt, setAwsEndpointOverride as et, AUTH_OFF_PLACEHOLDER_CREDENTIALS as f, AWS_ENDPOINT_SERVICE_IDS as ft, HOST_CA_TRUST_ENV_KEYS as g, defineOwnKey as gt, EMULATOR_SCRUBBED_ENV_KEYS as h, resolveEnvVars as ht, assumedRoleRecorded as i, emulatedServicesForWorkload as it, probeAwsEmulatorHealth as j, mergeJavaToolOptions as k, warnWorkloadCredentialsStripped as l, readAwsEmulatorSentinelsFromFile as lt, DEFAULT_AWS_EMULATOR_URL as m, readEnvVarsFileText as mt, accountLookupStsClientConfig as n, MIXED_MODE_RESIGN_PORT as nt, readEnvCallerCredentials as o, findAwsEmulatorSentinels as ot, CA_TRUST_ENV_KEYS as p, applyEnvOverrideMap as pt, getAwsEmulatorServiceRouting as q, applyWorkloadEnvCredentials as r, createMixedModeStateProvider as rt, recordAssumedRole as s, isAwsEmulatorSentinel as st, SECOND_ASSUME_MESSAGE as t, AWS_EMULATOR_SENTINEL as tt, workloadClientConfig as u, resourceTypeMatchesEmulatedService as ut, activateWorkloadAwsWiring as v, isWildcardHostname as vt, getActiveWorkloadAwsWiring as w, collectHostEndpointOverrides as x, hostFromAuthority as xt, applyWorkloadAwsWiringToEnv as y, formatAuthority as yt, writeCaBundleFile as z };
2300
- //# sourceMappingURL=workload-identity-BOEZuEDO.js.map
2682
+ export { isAwsServiceRoutedToEmulator as $, parseAwsEndpoint as A, workload_aws_wiring_exports as B, effectiveLoopbackPorts as C, resolveEnvVars as Ct, javaTruststoreToolOptions as D, formatAuthority as Dt, getContainerJavaTruststorePath as E, isWildcardHostname as Et, resolveHostDefaultCredentials as F, awsClientConfigForService as G, MIXED_MODE_RESIGN_BODY_CAP_BYTES as H, resolveWorkloadAwsWiring as I, buildProxyClientConfig as J, awsEmulatorRealServices as K, setActiveWorkloadAwsWiring as L, readEmulatorRunFiles as M, readProfileEndpointSettings as N, loopbackForwarderPlan as O, formatHostForAuthority as Ot, resolveAwsEmulatorOption as P, getAwsEndpointOverride as Q, takeAwsEmulatorStateSourceHint as R, displayEndpointValue as S, readEnvVarsFileText as St, getContainerCaBundlePath as T, isLoopbackHostname as Tt, RESIGN_SIDECAR_SCRIPT as U, writeCaBundleFile as V, createMixedModeTlsMaterials as W, deployArtifactsReadEmulator as X, deployArtifactClientConfig as Y, getAwsEmulatorServiceRouting as Z, HOST_DEFAULT_CREDENTIALS_MISS_TTL_MS as _, realAwsServicesOf as _t, deployAccountStsClientConfig as a, LEGACY_AWS_EMULATOR_SENTINEL as at, awsEmulatorEnvName as b, AWS_ENDPOINT_SERVICE_IDS as bt, resetWorkloadIdentity as c, createMixedModeStateProvider as ct, workloadStsClientConfig as d, isLegacyAwsEmulatorSentinel as dt, isProxyEnvConfigured as et, AUTH_OFF_PLACEHOLDER_CREDENTIALS as f, isRealAwsSentinel as ft, HOST_CA_TRUST_ENV_KEYS as g, realAwsServicesForWorkload as gt, EMULATOR_SCRUBBED_ENV_KEYS as h, realAwsEndpointFor as ht, assumedRoleRecorded as i, setAwsEndpointOverride as it, probeAwsEmulatorHealth as j, mergeJavaToolOptions as k, hostFromAuthority as kt, warnWorkloadCredentialsStripped as l, findLegacyAwsEmulatorSentinels as lt, DEFAULT_AWS_EMULATOR_URL as m, readAwsEmulatorEnvVarsFile as mt, accountLookupStsClientConfig as n, proxyAwareFetch as nt, readEnvCallerCredentials as o, MIXED_MODE_RESIGN_PORT as ot, CA_TRUST_ENV_KEYS as p, legacyAwsEmulatorSentinelMessage as pt, awsEndpointOverrideClientConfig as q, applyWorkloadEnvCredentials as r, setAwsEmulatorServiceRouting as rt, recordAssumedRole as s, REAL_AWS_SENTINEL as st, SECOND_ASSUME_MESSAGE as t, normalizeAwsEndpointServiceId as tt, workloadClientConfig as u, findRealAwsExceptions as ut, activateWorkloadAwsWiring as v, resourceTypeMatchesService as vt, getActiveWorkloadAwsWiring as w, defineOwnKey as wt, collectHostEndpointOverrides as x, applyEnvOverrideMap as xt, applyWorkloadAwsWiringToEnv as y, validateAwsEmulatorEnvVars as yt, workloadGetsEmulatorKeysOnly as z };
2683
+ //# sourceMappingURL=workload-identity-CCXbr0KK.js.map