The cdk.json
file tells the CDK Toolkit how to execute your app.
yarn build
compile typescript to jsyarn lint
check code styleyarn destroy
destroy the current stackyarn deploy
deploy this stack to your default AWS account/regionyarn bootstrap
clean up env
- Install Docker if you haven’t already. https://docs.docker.com/get-docker/
- Install AWS CLI. While we won’t be working with “real” AWS we will be using it to communicate with our local docker containers. https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-install.html
Avoid the mistake when we use cdk
command maybe it can impact to real environment
This lib provides a thin wrapper script cdklocal for using the AWS CDK library against local APIs provided by LocalStack.
Refer : https://github.com/localstack/aws-cdk-local
npm install -g aws-cdk-local aws-cdk
Or yarn
yarn global add aws-cdk-local aws-cdk
$ cdklocal --version 1.65.5
Step 1. init create a fake aws credentials - use for our localstack as below ( This is required for our localstack )
cat ~/.aws/credentials
[default]
aws_access_key_id = test
aws_secret_access_key = test
region = us-west-2
output = json
{
"services": {
"dynamodbstreams": "running",
"firehose": "running",
"kinesis": "running",
"s3": "running",
"ses": "running",
"sns": "running",
"sqs": "running",
"dynamodb": "running"
}, "features": {"persistence": "initialized", "initScripts": "initialized"}
}
yarn deploy
IAM Statement Changes ...
┌───┬───────────────────────┬────────┬─────────────────┬───────────────────────────┬───────────────────────────────────────────────────────┐
│ │ Resource │ Effect │ Action │ Principal │ Condition │
├───┼───────────────────────┼────────┼─────────────────┼───────────────────────────┼───────────────────────────────────────────────────────┤
│ + │ ${SampleAppQueue.Arn} │ Allow │ sqs:SendMessage │ Service:sns.amazonaws.com │ "ArnEquals": { │
│ │ │ │ │ │ "aws:SourceArn": "${SampleAppTopic}" │
│ │ │ │ │ │ } │
└───┴───────────────────────┴────────┴─────────────────┴───────────────────────────┴───────────────────────────────────────────────────────┘
(NOTE: There may be security-related changes not in this list. See https://github.com/aws/aws-cdk/issues/1299)
Do you wish to deploy these changes (y/n)?
#### Type `y` and see our stack
ApplicationStack: deploying...
ApplicationStack: creating CloudFormation changeset...
✅ ApplicationStack
Stack ARN:
arn:aws:cloudformation:us-west-2:000000000000:stack/ApplicationStack/e67d04e2
aws --endpoint-url=http://localhost:4566 dynamodb list-tables
{
"TableNames": [
"test-development"
]
}
aws --endpoint-url=http://localhost:4566 dynamodb describe-table --table-name test-development
Tool | Description |
---|---|
S3 Viewer (MAC & Win) https://cyberduck.io/ |
![]() |
DynamoDB Viewer (MAC & Win) https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/workbench.settingup.html |
![]() |
SQS Sender https://github.com/kobee-tech-stack/sqs-viewer |