Skip to content

Commit

Permalink
add example to use environment parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
razin99 committed Mar 31, 2024
1 parent 3852ed6 commit be5303c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions packages/aws-cdk-lib/aws-ec2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1426,6 +1426,22 @@ ec2.CloudFormationInit.fromElements(
);
```

If your services require environment variables, you can use the `environmentVariables` or `environmentFiles`
parameter to do so:
```ts
new ec2.InitConfig([
ec2.InitFile.fromString('/myvars.env', 'VAR_FROM_FILE="VAR_FROM_FILE"'),
ec2.InitService.systemdConfigFile('myapp', {
command: '/usr/bin/python3 -m http.server 8080',
cwd: '/var/www/html',
environmentVariables: {
MY_VAR: 'MY_VAR',
},
environmentFiles: ['/myvars.env'],
}),
])
```

### Bastion Hosts

A bastion host functions as an instance used to access servers and resources in a VPC without open up the complete VPC on a network level.
Expand Down

0 comments on commit be5303c

Please sign in to comment.