Questions tagged with AWS Command Line Interface
Content language: English
Sort by most recent
Hey there,
I've been trying to send the logs of my IoT Greengrass core device to Cloudwatch following [this guide](https://docs.aws.amazon.com/greengrass/v2/developerguide/monitor-logs.html#enable-cloudwatch-logs). It says to create a deployment and inserting this:
```
{
"logsUploaderConfiguration": {
"systemLogsConfiguration": {
"uploadToCloudWatch": "true"
}
}
}
```
and this, accordingly:
```
{
"logsUploaderConfiguration": {
"componentLogsConfigurationMap": {
"com.example.HelloWorld": {
}
}
}
}
```
I just don't get how and where I have to insert those. It's really not explained that much... My last attempt was to create a deployment.json file that looked as follows and push it to AWS through the CLi command `aws greengrassv2 create-deployment --cli-input-json file://deployment.json`, but that doesn't work:
```
{
"targetArn": "arn:aws:iot:<myregion>:<mynumber>:thinggroup/groupname",
"deploymentName": "test_deployments",
"components": {
"aws.greengrass.Cloudwatch": {
"componentVersion": "3.1.0"
},
"aws.greengrass.LogManager": {
"componentVersion": "2.3.1",
"logsUploaderConfiguration": {
"systemLogsConfiguration": {
"uploadToCloudWatch": "true"
},
"componentLogsConfigurationMap":{
"com.example.MyPrivateDockerComponent": {
}
}
}
},
"com.example.MyPrivateDockerComponent": {
"componentVersion": "1.1.5",
"runWith": {}
}
},
"deploymentPolicies": {
"failureHandlingPolicy": "ROLLBACK",
"componentUpdatePolicy": {
"timeoutInSeconds": 60,
"action": "NOTIFY_COMPONENTS"
}
},
"iotJobConfiguration": {
"jobExecutionsRolloutConfig": {
"maximumPerMinute": 1000
}
},
"tags": {}
}
```
Can anyone tell me where to place the "logsUploaderConfiguration" that I can accordingly update my deployment to log to Cloudwatch? Also, is this somehow possible through the AWS console in addition to the CLI?
Thanks a lot for your help!
Hello
I run the following example from the documentation
[AWS CLI apigateway put-integration](https://docs.aws.amazon.com/cli/latest/reference/apigateway/put-integration.html)
```
aws apigateway put-integration --rest-api-id 1234123412 --resource-id a1b2c3 --http-method GET --type AWS --integration-http-method POST --uri 'arn:aws:apigateway:us-west-2:lambda:path/2015-03-31/functions/arn:aws:lambda:us-west-2:123412341234:function:function_name/invocations'
```
But got the following error :
```
An error occurred (NotFoundException) when calling the PutIntegration operation: Invalid Method identifier specified
```
Of course I took good `--rest-api-id` value and `--resource-id` value.
Does the issue may comes from the URI ?
Please advise ?
Somehow the following S3 buckets were created in the AWS account without a region and we cannot delete them or view them

We can also see them on the CLI doing
```
aws s3 ls
```
but trying to delete them we get the following
```
aws s3 rb s3://manccs-sanda-xxxxxxxx
remove_bucket failed: s3://manccs-sanda-xxxxxxxx An error occurred (NoSuchBucket) when calling the DeleteBucket operation: The specified bucket does not exist
```
Doing this as Account admin and have even tried using the root user but same result. How do we get rid of these buckets ?
Note same issue as [this](https://repost.aws/questions/QUQrSwX2PNSQKDb-y9MTibtA/i-find-a-bucket-without-aws-region-in-my-s-3-but-i-cannot-delete-it) but no answer
I am working on AWS Greengrass for deploying my code to a 32bit Raspberry Pi4 remotely. I have successfully downloaded the latest version of **Greengrass nucleus**. The **aws version is 1.27.84**. After uploading the code and granting permissions, my deployment status remains at "In Progress". Could anyone tell me why this is happening?
Thank You
Hi,
This CLI command to create a job from an AWS managed template works:
```
$ aws iot create-job --targets 'arn:aws:iot:region:account:thing/thingname' --job-id 'test-aws-job' --job-template-arn 'arn:aws:iot:region::jobtemplate/AWS-Run-Command:1.0' --document-parameters '{"command": "ls","runAsUser": "root"}'
```
but this seemingly equivalent CDK custom resource doesn't. CDK deploy returns `Message returned: Document parameters are only supported for managed job templates.`:
```
const testAwsJobUuid = 'test-aws-job' + uuidv4();
const testDocumentParameters = new Map<string, string>([
["command", "ls"],
["runAsUser", "root"]
]);
const testAwsJob = new cr.AwsCustomResource(this, 'test-aws-job', {
onCreate: {
service: 'Iot',
action: 'createJob',
parameters: {
targets: [`arn:aws:iot:${process.env.CDK_DEFAULT_REGION}:${process.env.CDK_DEFAULT_ACCOUNT}:thing/thingname`],
jobTemplateArn: `arn:aws:iot:${process.env.CDK_DEFAULT_REGION}:${process.env.CDK_DEFAULT_ACCOUNT}:jobtemplate/AWS-Run-Command:1.0`,
documentParameters: testDocumentParameters,
jobId: `${testAwsJobUuid}`
},
physicalResourceId: cr.PhysicalResourceId.of(Date.now().toString()),
},
policy: cr.AwsCustomResourcePolicy.fromSdkCalls({
resources: cr.AwsCustomResourcePolicy.ANY_RESOURCE,
}),
});
```
Many thanks, Gary
I tried to cancel while exporting ec2, but the following error occurred.
```
An error occurred (IncorrectState) when calling the CancelExportTask operation: Task can not be cancelled at this stage:
```
It is said that it cannot be canceled at this stage, but when can it be canceled?
Hello, when we see the AWS data pipeline console we see a message that AWS is planning to remove access to console by 04/03/2023. So we are checking how can we use the data pipelines from AWS CLI commands. Please can you let me know what AWS CLI command can be used to check the error stack trace of a pipeline with status FAILED.
I have checked https://docs.aws.amazon.com/datapipeline/latest/DeveloperGuide/dp-troubleshoot-locate-errors.html where the steps are described for checking error from AWS console.
I have also checked https://docs.aws.amazon.com/datapipeline/latest/DeveloperGuide/dp-error-logs.html but from the pipelineLogUri we can only receive the Activity log but not the error stack trace.
Please help.
When I run `aws sso login` I get the following error:
```
$ aws sso login
aws sso login: command not found
```
All other `aws` commands work fine.
`aws sso help` returns the sso man page with a description and available commands:
```
AVAILABLE COMMANDS
o get-role-credentials
o help
o list-account-roles
o list-accounts
o login
o logout
```
I get the same error for the other `aws sso` commands (except `help`):
```
$ aws sso logout
aws sso logout: command not found
$ aws sso get-role-credentials
aws sso get-role-credentials: command not found
$ aws sso list-account-roles
aws sso list-account-roles: command not found
$ aws sso list-accounts
aws sso list-accounts: command not found
```
Using:
```sh
$ aws --version
aws-cli/2.11.2 Python/3.11.2 Linux/5.15.90.1-microsoft-standard-WSL2 exe/x86_64.ubuntu.22 prompt/off
```
Installed following [these instructions](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html).
Debug output:
```
$ aws --debug sso login
2023-03-14 11:30:36,369 - MainThread - awscli.clidriver - DEBUG - CLI version: aws-cli/2.11.2 Python/3.11.2 Linux/5.15.90.1-microsoft-standard-WSL2 exe/x86_64.ubuntu.22
2023-03-14 11:30:36,369 - MainThread - awscli.clidriver - DEBUG - Arguments entered to CLI: ['--debug', 'sso', 'login']
2023-03-14 11:30:36,383 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler <function add_s3 at 0x7f030ab953a0>
2023-03-14 11:30:36,383 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler <function add_ddb at 0x7f030b5d6840>
2023-03-14 11:30:36,383 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler <bound method BasicCommand.add_command of <class 'awscli.customizations.configure.configure.ConfigureCommand'>>
2023-03-14 11:30:36,383 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler <function change_name at 0x7f030b554a40>
2023-03-14 11:30:36,383 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler <function change_name at 0x7f030b5560c0>
2023-03-14 11:30:36,383 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler <function alias_opsworks_cm at 0x7f030ab97880>
2023-03-14 11:30:36,383 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler <function add_history_commands at 0x7f030af25260>
2023-03-14 11:30:36,383 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler <bound method BasicCommand.add_command of <class 'awscli.customizations.devcommands.CLIDevCommand'>>
2023-03-14 11:30:36,383 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler <function add_waiters at 0x7f030ab97740>
2023-03-14 11:30:36,383 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler <bound method AliasSubCommandInjector.on_building_command_table of <awscli.alias.AliasSubCommandInjector object at 0x7f030a151750>>
2023-03-14 11:30:36,384 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /usr/local/aws-cli/v2/2.11.2/dist/awscli/data/cli.json
2023-03-14 11:30:36,387 - MainThread - botocore.hooks - DEBUG - Event top-level-args-parsed: calling handler <function resolve_types at 0x7f030afd6ac0>
2023-03-14 11:30:36,387 - MainThread - botocore.hooks - DEBUG - Event top-level-args-parsed: calling handler <function no_sign_request at 0x7f030afd6de0>
2023-03-14 11:30:36,387 - MainThread - botocore.hooks - DEBUG - Event top-level-args-parsed: calling handler <function resolve_verify_ssl at 0x7f030afd6d40>
2023-03-14 11:30:36,387 - MainThread - botocore.hooks - DEBUG - Event top-level-args-parsed: calling handler <function resolve_cli_read_timeout at 0x7f030afd6f20>
2023-03-14 11:30:36,388 - MainThread - botocore.hooks - DEBUG - Event top-level-args-parsed: calling handler <function resolve_cli_connect_timeout at 0x7f030afd6e80>
2023-03-14 11:30:36,388 - MainThread - botocore.hooks - DEBUG - Event top-level-args-parsed: calling handler <built-in method update of dict object at 0x7f030a14eac0>
2023-03-14 11:30:36,388 - MainThread - awscli.clidriver - DEBUG - CLI version: aws-cli/2.11.2 Python/3.11.2 Linux/5.15.90.1-microsoft-standard-WSL2 exe/x86_64.ubuntu.22 prompt/off
2023-03-14 11:30:36,388 - MainThread - awscli.clidriver - DEBUG - Arguments entered to CLI: ['--debug', 'sso', 'login']
2023-03-14 11:30:36,388 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function add_timestamp_parser at 0x7f030ab95d00>
2023-03-14 11:30:36,388 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function register_uri_param_handler at 0x7f030bd30220>
2023-03-14 11:30:36,388 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function add_binary_formatter at 0x7f030a120d60>
2023-03-14 11:30:36,388 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function no_pager_handler at 0x7f030bd04a40>
2023-03-14 11:30:36,388 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function inject_assume_role_provider_cache at 0x7f030bd51b20>
2023-03-14 11:30:36,389 - MainThread - botocore.utils - DEBUG - IMDS ENDPOINT: http://169.254.169.254/
2023-03-14 11:30:36,391 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function attach_history_handler at 0x7f030af09b20>
2023-03-14 11:30:36,391 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function inject_json_file_cache at 0x7f030b5beac0>
2023-03-14 11:30:36,400 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /usr/local/aws-cli/v2/2.11.2/dist/awscli/botocore/data/sso/2019-06-10/service-2.json
2023-03-14 11:30:36,402 - MainThread - botocore.hooks - DEBUG - Event building-command-table.sso: calling handler <function add_sso_commands at 0x7f030b5bcea0>
2023-03-14 11:30:36,402 - MainThread - botocore.hooks - DEBUG - Event building-command-table.sso: calling handler <function add_waiters at 0x7f030ab97740>
2023-03-14 11:30:36,409 - MainThread - botocore.hooks - DEBUG - Event building-command-table.sso: calling handler <bound method AliasSubCommandInjector.on_building_command_table of <awscli.alias.AliasSubCommandInjector object at 0x7f030a151750>>
2023-03-14 11:30:36,411 - MainThread - botocore.hooks - DEBUG - Event building-command-table.sso_login: calling handler <function add_waiters at 0x7f030ab97740>
2023-03-14 11:30:36,411 - MainThread - botocore.hooks - DEBUG - Event building-command-table.sso_login: calling handler <bound method AliasSubCommandInjector.on_building_command_table of <awscli.alias.AliasSubCommandInjector object at 0x7f030a151750>>
2023-03-14 11:30:36,411 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.custom.login.no-browser: calling handler <awscli.paramfile.URIArgumentHandler object at 0x7f030a185650>
2023-03-14 11:30:36,412 - MainThread - botocore.hooks - DEBUG - Event process-cli-arg.custom.login: calling handler <awscli.argprocess.ParamShorthandParser object at 0x7f030ab99c10>
2023-03-14 11:30:36,412 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.custom.login.sso-session: calling handler <awscli.paramfile.URIArgumentHandler object at 0x7f030a185650>
2023-03-14 11:30:36,412 - MainThread - awscli.clidriver - DEBUG - Exception caught in main()
Traceback (most recent call last):
File "awscli/clidriver.py", line 460, in main
File "awscli/clidriver.py", line 595, in __call__
File "awscli/customizations/commands.py", line 205, in __call__
File "awscli/customizations/sso/login.py", line 43, in _run_main
File "awscli/customizations/sso/utils.py", line 166, in _get_sso_config
File "awscli/customizations/sso/utils.py", line 195, in _get_legacy_sso_config
```
I tried uninstalling following [these instructions](https://docs.aws.amazon.com/cli/latest/userguide/uninstall.html) and installing again, that didn't solve the problem.
Running `/usr/local/bin/aws sso login` works.
```
$ which aws
/usr/local/bin/aws
$ whereis aws
aws: /usr/local/bin/aws
# There are no alias for aws
$ alias | grep aws
```
Running it as an alias also works:
```
$ aws sso login
aws sso login: command not found
$ alias pippo='aws sso login'
$ pippo
Attempting to automatically open the SSO authorization page in your default browser.
If the browser does not open or you wish to use a different device to authorize this request, open the following URL:
https://device.sso.eu-west-1.amazonaws.com/
```
What can I do to troubleshoot this issue?
I am trying to download a dataset from S3 bucket using aws interface.
I have the security code and other details.
But when I type the code for downloading the data, I get an error.
I am not even able to see the contents of that bucket. I tried several ways but I am unable to check what the issue is.
It is an open source data so i don't think it is the access error.
The data source I want to download is world bank lights at night data in .tif format.
Any suggestions would be helpful.
I am deploying the components from s3 bucket, but it stucked in “In process”. I think it is permissions error for this, I followed [https://docs.aws.amazon.com/greengrass/v2/developerguide/device-service-role.html]. But it still in process, can anyone tell me the more about it.
Thank you
Nik
Trying to push project to Amplify console using "Amplify push" getting this error..


Can you please help me on this issue. If it is because of exposed API key, can you please guide me how to rotate my API key.
Thank you!
Hello, I tried the following tutorial https://docs.aws.amazon.com/en_us/apigateway/latest/developerguide/api-gateway-create-api-as-simple-proxy-for-http.html. But when I use my own URL for testing purposes I got the following error:
Thu Mar 09 16:16:27 UTC 2023 : Execution failed due to configuration error: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
Thu Mar 09 16:16:27 UTC 2023 : Method completed with status: 500
If I look at the certificate, it is not a selfsigned cert, and it is not expired. How can I install that certificate in my AWS API Gateway environment.
It is worth mentioning that the destination port is not the standard (443).