I have tried to install AWS CDK in my local system, using this command "npm install -g aws-cdk" getting installed successfully, but when I am checking version with cdk --version i am getting Microsoft JScript compilation error
Script : C:\Users\170905\AppData\Roaming\npm\node_modules\aws-cdk\bin\cdk.js
Line: 1
Char: 1
Error: Invalid Character
Code: 800A03F6
Source: Microsoft Jscript compilation error
set the path using below command and try.
**setx PATH "C:\Users\<username>\AppData\Roaming\npm"**
or directly navigate to this path and open cmd. It will work.
Related
I'm trying to build docker container and push to to ECR repository. All is working fine locally, but once moved to AWS I'm getting error:
dpkg-deb: error: 'docker-ce_20.10.3_3-0_ubuntu-bionic_amd64.deb' is not a Debian format archive
dpkg: error processing archive docker-ce_20.10.3_3-0_ubuntu-bionic_amd64.deb (--install):
dpkg-deb --control subprocess returned error exit status 2
from following commands in Docker file:
COPY docker-assets/docker-ce_20.10.3_3-0_ubuntu-bionic_amd64.deb /home/folder/
RUN dpkg -i docker-ce_20.10.3_3-0_ubuntu-bionic_amd64.deb
Can anyone hit the same issue / help me out ?
I did workaround this with URL
Unable to deploy AWS Lambda C# blank function
I believe that the following line is failing:
dotnet lambda package
I am getting started with AWS and Lambda. My platform is a bash shell on Windows 10. I have installed AWS CLI v2, and .NET Core v3.1, both appear to be installed ok:
$ aws --version
aws-cli/2.1.13 Python/3.7.9 Windows/10 exe/AMD64 prompt/off
$ dotnet --version
3.1.404
I am trying to walk through the blank function sample:
https://docs.aws.amazon.com/lambda/latest/dg/samples-blank.html
Instructions for C#:
https://github.com/awsdocs/aws-lambda-developer-guide/blob/main/sample-apps/blank-csharp/README.md
Per the instructions, I added the following to my .aws/config file:
cli_binary_format = raw-in-base64-out
The first step was successful, the S3 bucket was created:
$ ./1-create-bucket.sh
make_bucket: lambda-artifacts-1234567890123456
$ aws s3 ls
2020-12-30 14:30:25 lambda-artifacts-1234567890123456
But the second step, deployment, fails:
$ ./2-deploy.sh
Could not execute because the specified command or file was not found.
Possible reasons for this include:
* You misspelled a built-in dotnet command.
* You intended to execute a .NET Core program, but dotnet-lambda does not exist.
* You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
The contents of that shell script are:
#!/bin/bash
set -eo pipefail
ARTIFACT_BUCKET=$(cat bucket-name.txt)
cd src/blank-csharp
dotnet lambda package
cd ../../
aws cloudformation package --template-file template.yml --s3-bucket $ARTIFACT_BUCKET --output-template-file out.yml
aws cloudformation deploy --template-file out.yml --stack-name blank-csharp --capabilities CAPABILITY_NAMED_IAM
I assume that the error is reported by line 5 invoking dotnet, since the error report refers to dotnet.
I tried to install the Lambda tools in dotnet, but that failed:
$ dotnet tool install -g Amazon.Lambda.Tools
error NU1100: Unable to resolve 'amazon.lambda.tools (>= 0.0.0)' for '.NETCoreApp,Version=v3.1'.
error NU1100: Unable to resolve 'amazon.lambda.tools (>= 0.0.0)' for '.NETCoreApp,Version=v3.1/any'.
The tool package could not be restored.
Tool 'amazon.lambda.tools' failed to install. This failure may have been caused by:
You are attempting to install a preview release and did not use the --version option to specify the version.
A package by this name was found, but it was not a .NET Core tool.
The required NuGet feed cannot be accessed, perhaps because of an Internet connection problem.
You mistyped the name of the tool.
For more reasons, including package naming enforcement, visit https://aka.ms/failure-installing-tool
Similar result when trying to install the Lambda templates:
$ dotnet new -i Amazon.Lambda.Templates
Determining projects to restore...
C:\Users\Me\.templateengine\dotnetcli\v3.1.404\scratch\restore.csproj : error NU1100: Unable to resolve 'Amazon.Lambda.Templates (>= 0.0.0)' for '.NETCoreApp,Version=v1.0'.
Failed to restore C:\Users\Me\.templateengine\dotnetcli\v3.1.404\scratch\restore.csproj (in 179 ms).
I tried uninstalling .NET Core SDK v3.1 and repeating with .NET Core SDK v2.1, and also with .NET SDK 5.0, same results. I tried disabling anti-virus, no effect.
Should I have installed the AWS SDK? I did try, but yet more failure. I downloaded
awssdk.lambda.3.5.6.8.nupkg
from
https://www.nuget.org/packages/AWSSDK.Lambda/
and from the directory containing this nupkg file:
$ dotnet add package AWSSDK.Lambda
Could not find any project in 'C:\AwsSdkLambda\'.
I'd very much appreciate any suggestions.
Thanks,
Henry
I have installed 'amplify-cli'. When I type 'amplify configure', I get the error message:
'amplify is not recognized as an internal or external command, operable program or batch file'.
Please share your platform. Are you developing on Linux, Windows (Powershell), or Linux on Windows (WSL/Ubuntu)?
Did you install the CLI globally?
Try this:
npm install -g #aws-amplify/cli
And see if that works. If the global install fails, you can try running this per an Amplify developer:
npm install -g #aws-amplify/cli --unsafe-perm=true
Edit: since you're on Windows, it's possible the CLI wasn't added to your $PATH variable. You can fix it by seeing this Github issue.
To solve this, simply edit a PATH key under system Environment Variables and add a new path pointing to amplify:
C:\Users\{UserName}\AppData\Roaming\npm\amplify.cmd
If you have globally installed amplify/cli then you should find two files named amplify and amplify.cmd in the above mentioned npm directory.
Under same circumstances I run all the suggested solutions on Windows 10 machine (64 bit). None of them seemed to do the trick.
I got a more specific error:
..... cannot be loaded because running scripts is disabled on this
system .... + CategoryInfo : SecurityError: (:) [],
PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
The issue appears due to Windows PowerShell execution policies. Eventually, I managed to amend it by applying the following:
C:\Windows\System32>powershell Set-ExecutionPolicy -Scope CurrentUser RemoteSigned
Above solutions didn't work for me, I had to run this instead of 'amplify init':
C:\Users{UserName}\AppData\Roaming\npm\amplify init
I had the same issue and my problem was because I was trying to install it using
yarn global add #aws-amplify/cli
Apparently, it doesn't work when it is installed with yarn it has to be npm. It's funny because there are no errors shown. There might be a fix to it maybe someone can look into that.
If you are on windows platform avoid using the global(-g) flag from your npm command. Install Amplify CLI with below npm command.
npm install #aws-amplify/cli
It worked for me.
Error:
amplify : The term 'amplify' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. le program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
amplify init
CategoryInfo : ObjectNotFound: (amplify:String) [], CommandNotFoundException
FullyQualifiedErrorId : CommandNotFoundException
Try this for windows:
Step 1:
npm install -g #aws-amplify/cli --unsafe-perm=true
Step 2:
npm config get prefix
Step 3:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
you must run this code on PowerShell not a cmd.
I had the same issue
For Windows, try the below command to install Amplify CLI
$ curl -sL https://aws-amplify.github.io/amplify-cli/install-win -o
install.cmd && install.cmd
$ amplify configure
for more info on installation follow the link
https://docs.amplify.aws/cli/start/install/
I have a go application, structured like this:
cmd|reports|main.go
main.go imports internal/reports package and has a single function, main(), which delegates call to aws-lambda-go/lambda.Start() function.
Code is build running the commands (snippet):
cd internal/reports && go build handler.go
cd ../..
go build -o reports ../cmd/reports/main.go && chmod +x reports && zip reports.zip reports
reports.zip is uploaded to AWS Lambda, which in turns throws an error when Test button is pressed:
{
"errorMessage": "fork/exec /var/task/reports: exec format error",
"errorType": "PathError"
}
reports is set as Lambda's Handler.
Also, code is build on Ubuntu 14.04 machine, as a part of aws/codebuild/ubuntu-base:14.04 Docker Image, on AWS CodeBuild. There should be no environment issues here, even though the error suggests a cross-platform problem.
Any ideas?
You have to build with GOARCH=amd64 GOOS=linux.
Wherever you build your binary, the binary for Lambda is run on Amazon Linux.
So , try this build command.
GOARCH=amd64 GOOS=linux go build handler.go
The issue is that main() function is not declared in main package, which is mandatory by Golang language spec
I receive an error when running the following command on AWS CLI
Command
$EC2_AMITOOL_HOME/bin/ec2-upload-bundle -b my-s3-bucket/bundle_folder/bundle_name -m /tmp/image.manifest.xml -a AKIAJKHXU4GRYW7KPDBQ -s IGaclJWIIjT7ixyb2gXPfJ8Z00U469Urt5DzGhaJ
Error
Signature version 4 authentication failed, trying different signature
version ERROR: Error talking to S3: Server.NotImplemented(501): A
header you provided implies functionality that is not implemented
I have allowed the full permission to the user but still getting this error
I have ran this command before the above command
Command:
$EC2_AMITOOL_HOME/bin/ec2-bundle-vol -k /tmp/ce rt/Cpanel.pem -c /tmp/cert/certificate.pem -u 589680520298 -r x86_64 -e /tmp/cer t --partition gpt
It ran successfully and I have successfully generated image.manifest.xml
Manual Reference: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/create-instance-store-ami.html#amazon_linux_instructions
Please Provide Correct region of your bucket to authentication array this problem will be resolved.