cdk LS failed because it doesn't find the app - aws-cdk

I'm running the sample-app but seems it doesn't work anymore
.env) [cdk-workshop]gdm$ cdk ls
CDK CLI >= 1.10.0 is required to interact with this app
(.env) [cdk-workshop]gdm$
Why?
the code is exactly https://cdkworkshop.com/30-python/20-create-project/100-cdk-init.html

the problem was my ckd version(1.9.0)
I've updated and now it works

Related

CDK deploy not recognizing my bootstrap and SSM parameter

I have a project with CDK and CDK Deploy does not work. My project is a simple CDK app that has been started with cdk init app --language typescript and was working at first. I don't have anything but a lambda and an api gateway in this project.
After adding NodejsFunction from #aws-cdk/aws-lambda-nodejs I faced some errors but by installing docker locally and some changes all those were resolved and synth completes successfully now.
I run cdk bootstrap and then cdk synth and then cdk deploy with the last one here is the error I see: (the rest finishes successfully)
SSM parameter /cdk-bootstrap/pipeline/version not found. Has the environment been bootstrapped? Please run 'cdk bootstrap' (see https://docs.aws.amazon.com/cdk/latest/guide/bootstrapping.html)
bootstrap and synth work fine, my aws configure has been done and no errors anywhere but the deploy doesn't work.
More details:
Error:
MyStackNameStack failed: Error: MyStackNameStack: SSM parameter /cdk-bootstrap/pipeline/version not found. Has the environment been bootstrapped? Please run 'cdk bootstrap' (see https://docs.aws.amazon.com/cdk/latest/guide/bootstrapping.html)
at CloudFormationDeployments.validateBootstrapStackVersion (/usr/local/lib/node_modules/aws-cdk/lib/api/cloudformation-deployments.ts:297:13)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at CloudFormationDeployments.publishStackAssets (/usr/local/lib/node_modules/aws-cdk/lib/api/cloudformation-deployments.ts:272:7)
at CloudFormationDeployments.deployStack (/usr/local/lib/node_modules/aws-cdk/lib/api/cloudformation-deployments.ts:179:5)
at CdkToolkit.deploy (/usr/local/lib/node_modules/aws-cdk/lib/cdk-toolkit.ts:184:24)
at initCommandLine (/usr/local/lib/node_modules/aws-cdk/bin/cdk.ts:213:9)
MyStackNameStack: SSM parameter /cdk-bootstrap/pipeline/version not found. Has the environment been bootstrapped? Please run 'cdk bootstrap' (see https://docs.aws.amazon.com/cdk/latest/guide/bootstrapping.html)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Package.json and CLI versions:
CDK version: 1.116.0
"#aws-cdk/aws-apigateway": "^1.116.0",
"#aws-cdk/aws-lambda": "^1.116.0",
"#aws-cdk/aws-lambda-nodejs": "^1.116.0",
"#aws-cdk/core": "^1.116.0",
I only use this:
cdk bootstrap

Error when deploying Lambda Docker using AWS CDK

I'm following https://sbstjn.com/blog/aws-cdk-lambda-docker-container-example/ and deploying Lambda Docker using AWS CDK. On 'cdk deploy' I get the following error. Link to my github repo is https://github.com/aqilzeeshan/cdk_dockerlambda
Can anyone tell me please what is the problem ? Thanks
Do you wish to deploy these changes (y/n)? y
CdkLambdaDockerStack: deploying...
[0%] start: Publishing dcfb2f152c6c0b2ca779c90dee5d59d3b510805a3ed884b310200624e32a4b27:current
Error: write EPIPE
at afterWriteDispatched (internal/stream_base_commons.js:156:25)
at writeGeneric (internal/stream_base_commons.js:147:3)
at Socket._writeGeneric (net.js:785:11)
at Socket._write (net.js:797:8)
at writeOrBuffer (internal/streams/writable.js:358:12)
at Socket.Writable.write (internal/streams/writable.js:303:10)
at C:\Users\amuham210\AppData\Roaming\npm\node_modules\aws-cdk\node_modules\cdk-assets\lib\private\shell.ts:28:19
at new Promise (<anonymous>)
at Object.shell (C:\Users\amuham210\AppData\Roaming\npm\node_modules\aws-cdk\node_modules\cdk-assets\lib\private\shell.ts:26:10)
at Docker.execute (C:\Users\amuham210\AppData\Roaming\npm\node_modules\aws-cdk\node_modules\cdk-assets\lib\private\docker.ts:75:13)
I found the problem. Docker needs to be installed to build the image. After installing docker on machine where I run 'cdk deploy' above issue is resolved.

Why is an admin account getting permission denied when updating a BucketPolicy?

I have an AWS CDK script that I'm now unable to deploy. I could deploy it before adding a bucket policy. After adding a bucket policy, it fails to deploy. Here's the Python code:
bucket = aws_s3.Bucket(
self,
"myBucket",
bucket_name="mybucket",
access_control=aws_s3.BucketAccessControl.PRIVATE,
versioned=True,
encryption=aws_s3.BucketEncryption.S3_MANAGED,
block_public_access=aws_s3.BlockPublicAccess.BLOCK_ALL
)
policy_statement = aws_iam.PolicyStatement(
effect=aws_iam.Effect.DENY,
actions=["*"],
resources=[bucket.arn_for_objects("*")],
conditions={ "Bool": { "aws:SecureTransport": "false" } }
)
policy_statement.add_any_principal()
bucket.add_to_resource_policy(policy_statement)
I deploy this stack using this command: cdk deploy --require-approval=never
And I see the following error:
2/4 | 10:01:03 AM | CREATE_IN_PROGRESS | AWS::S3::BucketPolicy | myBucket/Policy (myBucketPolicyAFBF75F8)
3/4 | 10:01:04 AM | CREATE_FAILED | AWS::S3::BucketPolicy | myBucket/Policy (myBucketPolicyAFBF75F8) API: s3:PutBucketPolicy Access Denied
The user I'm using to deploy this is an admin user with access to everything. I've confirmed that I can log into the console, create this bucket, and add this Bucket Policy with this same user, but for some reason I get a permission denied error when deploying the CDK script.
I'm relatively new to CDK and AWS, so, it may be something simple that I'm missing. Any help would be appreciated.
AWS CLI Version 2.0.3
Python Version 3.7.5
CDK Version 1.31.0 (build 8f3ac79)
Botocore Version 2.0.0dev7
Windows 10
UPDATE:
I updated my CDK install to the latest and now it's deploying just fine. No code changed, just my CDK version. I'm now running 1.32.2 (build e19e206) and it deployed. In looking through the release notes, I can't tell exactly why it was broken before and why it's working now, but they did make some changes in IAM and one of them must have fixed this.

CircleCI CLI Error on Ubuntu WSL: open .circleci/config.yml: no such file or directory

I'm trying to get the CircleCI CLI tool ( https://circleci.com/docs/2.0/local-jobs/ ) working on Ubuntu WSL on Windows 10. It appeared to install successfully -- and the file permissions appear to be correct. I have Docker for Windows installed and running, and the Linux Docker client works without issue.
But now it always errors when trying to validate a CircleCI config file.
I have tried:
circleci config validate -c .circleci/config.yml
and
circleci config validate
from the root of my repo.
But each time, it gives the error:
Error: open .circleci/config.yml: no such file or directory
Has anyone been able to get this work?
sudo worked for me to overcome this. However, I stuck with the next error.

Docker run hello-world not working

I've installed Docker following exactly the documentation on the website but when I try to run docker run hello-world, I get the following output from the terminal:
Saved file tree to doc-filelist.js
Copied JS to doc-script.js
Compiled CSS to doc-style.css
Does anybody have an idea what is going wrong?
Is it possible that you have docker.js installed locally?
The output from your command looks like the docker.js docker executable is called instead of the Docker container one.
The log messages that you showed can be found in the docker.js documentation, it looks like you're running that instead of the one you want.
If this is the issue run npm uninstall -g docker
I was experiencing the same issue, and it turned out to be caused by running nvm (node version manager). When I used nvm to run Node, Docker was not recognized. However, when I removed nvm, Docker worked as expected. I'm sure there's a workaround to make nvm and Docker work together, and I'll look into that later so I can continue using both tools.

Resources