DEV Community

Discussion on: Part 3 - Simple EC2 instance - Awesome AWS CDK

Collapse
 
kranshah profile image
Karan Shah

Very useful article. All works fine except .env file variables aren't getting loaded, had to hardcode account and region at last. Is there any step missing?

Collapse
 
emmanuelnk profile image
Emmanuel K

Did you configure your aws profile in ./aws/config?

Collapse
 
kranshah profile image
Karan Shah

Yes, cdk only works when when I'm hardcoding the account/region

require('dotenv').config()

const config = {
env: {
// account: '7339854xxxxx',
// region: 'us-east-1'
account: process.env.AWS_ACCOUNT_NUMBER,
region: process.env.AWS_REGION
}
}

Thread Thread
 
christiangilaquino profile image
Christian

have you checked AWS_ACCOUNT_REGION instead of AWS_REGION only