npx medplum aws init issue
# support
s
Hi Team, I'm receving below menitoned error while trying to generate CDK json file using npx medplum aws init : Medplum uses AWS CloudFront Presigned URLs for binary content such as file uploads. Error: Region is missing
r
hi @sajid_medrecord - happy to help. There's many reasons you may get this error, so this may require some back and forth. 1st question - how far were you able to get via the interactive prompts?
s
Hi @rahul1 below mentioned is cdk JSON file, based upon how far I'm able to reach via interactive prompts, please check and let me know what can be done to resolve it
Hi @rahul1 please help with this issue I'm stuck because of it I'm unable to deploy medplum
m
The Medplum team are amazing! And give great support and engagement with us in the community. I think (?) most of them are on the west coast of the US, so your last update came to them at 9:30pm on a Friday night. Unless we are paying for the enterprise support, the docs say we are on our own. I am sure Rahul will try and help as he can -- love how engaged they are -- but after the weekend likely a good hope. What I can offer is what they have builds fine in Docker and you can deploy locally (other than the amazon storage it still needs, and bots). There are lots of guides on building your own container for azure... If you are going it on your own particular on a platform they aren't focused on... might be worth it to get down into the weeds on the code. I have an interest too in Azure, but going to work on a fully local install first I think (with a replacement for the s3 storage and bots running local in a local cloud). Would be great to hear more about your experience (as well as those doing gcp) as you work through it! The other reason I encourage getting into the weeds of it, is my experience with this... Those of us running it ourselves likely will have specific needs/goals that might mean we have to hack it ourselves... Better to get into it early! It is a bit wild, but it is wild how much ChatGPT -- particularly 4, which can google the medplum and other doc - can be a good "sounding board" to troubleshoot this stuff.
r
Thank you so much for the kind words @mik401 🥰
@sajid_medrecord the first most likely cause is you AWS CLI credentials (https://www.medplum.com/docs/self-hosting/install-on-aws#aws-cli-setup)
the first step to diagnose would be to list you AWS cloudformation stacks using the AWS CLI (w/o medplum): https://docs.aws.amazon.com/cli/latest/reference/cloudformation/list-stacks.html
Please let me know if your stack
MedplumTest
shows up in the terminal, and we can go from there
s
No it' s not showing inside cloudformation stack summaries and receives following error if tries to run - npx cdk synth -c config=medplum.demo.config.json
r
Do you mind posting the output of
list-stacks
as well? To cross-check, can you see the CloudFormation stack if if you log into the AWS console webapp?
This is most likely an issue with your AWS CLI setup. Specifically, that your CLI cannot authenticate into your stack. We give some pointers here, but you'll have to use the AWS docs to set up your credentials file correctly https://www.medplum.com/docs/self-hosting/install-on-aws#aws-cli-setup
s
Yes I can as I have the admin access premission with my account
r
cc: @posarah we are addressing the problem here
@sajid_medrecord can please you confirm that the
MedplumTest
stack shows up in AWS console in the
CloudFormation
section?
And have you followed the instructions from Amazon for setting up your AWS credentials file?
s
No there isn't any stack present on aws cloudformation stack
As Yes I'm able to configure my profile sucssesfully using aws cli with aws configure cmd
r
Thank you. So what this means is that, while your configuration file was generated successfully, the AWS CLI could not determine your default region
And this is the page we link to from our site: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html Is there a region specified for the default profile?
s
Still why do i need to fix defaul region , is it neccessary for npm medplum aws init as in past I was able to work even with out setting a default
Although I think it's not neccessary but I have still configured the default region
@rahul1 Is there any manual way with which I can configure it, I have tried but it didn't work where I have create publically accessiable s3 buckets for app, storage and graphiql service, and I'm running server, database and redis using docker-compose on VM, as I have gone through the config setting page - https://www.medplum.com/docs/self-hosting/config-settings, tried to use that app and storage aws domain name as parameter values for appBaseUrl and storageBaseUrl but still all these service are not connection to each other
r
@sajid_medrecord , in general I would not recommend this, but if you'd like to work manually you can try to replicate the steps of our CDK scripts. https://github.com/medplum/medplum/blob/main/packages/cdk/src/index.ts
I'm happy to help you continue to debug. If you don't want to set a default profile in your
credentials
file, you can also use the env var
AWS_REGION
Continuing to debug, I wanted to understand how many of these steps from
aws init
completed successfully/ This is my understanding. Could you please confirm: 1. ✅ CDK config file generated 2. ✅ Signing key generated 3. ✅ SSL Certificate requested 4 ❌ Parameters written to parameter store
The next step i would try is using
medplum aws init
with the
AWS_REGION
var set in your shell
s
Hi @rahul1 I confirm that able to complete medplum aws init part, but when I'm trying to run either npx cdk synth, diff or deploy receives below mentioned error:
Please confirm that after I run npx medplum aws init and then npx cdk bootstrap -c config=medplum.test.config.json, I get to see there are two stacks got create one at my selected region eu-west-1 and other at us-east-1, need to know why is there two stacks been initiated:
Hi @rahul1 and team, I'm able to resolve above issue now just needed one confirmation from your side, whether do i need to manually add certificates for app, api, and storage domains or the SSL certificate has been generated by cmd - "npx cdk deploy -c config=" will be fine, I'm asking this because as I'm receving below mentioned error while deploying the infra:
Hi @rahul1 thanks for all you assistance, I'm able to resolve above issue, hence using cdk i'm able to create required infra, but when I'm trying to deploy app using npx medplum aws deploy-app TEST recevies below mentioned error:
m
What's in the log?
r
hi @sajid_medrecord - so sorry for the delay. We're glad that you were able to work through some of the issues above. If you;re willing to share the solutions you found at each step, that would be very helpful for others who encounter the same error
It seems like it can't find the medplum cli tools. Does the following work?
npx medplum --help
?
I also see that you're in a different directory
~/medplum
vs.
~/my-medplum-cdk-config
. According to the instructions, all the commands should be run from inside your CDK config directory