Can not remove a permission of lambda function in AWS CLI - aws-lambda

I can add permission to Lambda function with the aws lambda add-permission command in AWS CLI. But I can't remove permission using aws lambda remove-permission command.
I run this command:
aws lambda remove-permission --function-name LAMBDA_NAME --statement-id SID
Here is the error:
An error occurred (ServiceException) when calling the RemovePermission
operation (reached max retries: 4): An error occurred and the request
cannot be processed.
Hope someone helps.

Related

AccessDenied when deploying serverless via aws-vault

I am trying to deploy serverless with the credentials stored in my aws-vault keychain.
However when I run aws-vault exec myprofile -- sls deploy I receive the following error:
An error occurred: MyLambdaFunction - AccessDenied. User doesn't have permission to call iam:GetRole.
The user has AdministratorAccess and I also gave him IAMFullAccess (which should not be needed)
When I deploy with the same credentials stored in ~.aws/credentials with sls deploy
it works.
According to the docs the session token generated by aws-vault has some restrictions:
You cannot call any IAM API operations unless MFA authentication information is included in the request.
You cannot call any AWS STS API except AssumeRole or GetCallerIdentity.
A work around is to use the --no-session
so aws-vault exec myprofile --no-session -- sls deploy works without any error.

Retrieve previous tak definition and prepare new task definition - Could not connect to endpoint https://ecs.********.amazonws.com/

can you help me?
I'm doing a continuous deployment with circle.ci...
The unity tests, build and push is working.
But when i try update the ecs task, i'm getting the error:
ERROR: Could not connect to the endpoint URL: https://ecs.********.amazonws.com/
in the circle.ci i'm using the orbs
aws-ecs: circleci/aws-ecs#2.2.1
Any idea what is happen?
I don't know what to think/search anymore..
Update:
I tried run the command
aws ecs update-service --service ng-prod-service --cluster ng-cluster --force-new-deployment
And to my surprise i get the same error..
But my aws login works..
aws ecr get-login-password --region sa-east-1 | docker login --username AWS --password-stdin 119120169187.dkr.ecr.sa-east-1.amazonaws.com
i think the problem is with my credentials...
So i made new credentials with new iam rules and registerd on circle.ci and then it works...
It was probably the iam rules or iam credentials...

AWS Cogntio user pool throwing PreSignUp invocation failed due to error AccessDeniedException (Lambda alias as Cognito trigger)

I have configured specific Lambda alias (Please note this) as Cognito trigger using CLI as there is no provision in web console to do so. Now I am getting PreSignUp invocation failed due to the error AccessDeniedException while signing up. I am not sure about it but this might be happening as I have configured trigger using CLI. I tried to locate Cognito specific role in IAM but I didn't find such role.
So how can I update missing permissions in IAM?
I used the following CLI command to update the permissions.
aws lambda add-permission --function-name <ARN of the lambda alias> --source-arn <user-pool-arn> --action lambda:InvokeFunction --principal cognito-idp.amazonaws.com

How do you provide an API Gateway integration authorisation to call a Lambda function?

When setting up an API to call an AWS Lambda function from the AWS API Gateway UI Console, you get asked whether you give API Gateway permission to call the Lambda function .
What is the equivalent when doing it via the AWS CLI?
I have set up two resources and two methods- one through the console and one through the command line.
When I call the one set up through the console, it works fine.
But when I call the one set up through the CLI, I get a response
{
"message": "Internal server error"
}
and if i test it through the API Gateway Test feature, I see
Execution failed due to configuration error: Invalid permissions on Lambda function
You will need to add permission to Lambda for the principal which is apigateway.amazonaws.com in your case.
E.g.
aws lambda add-permission --function-name LambdaFunctionOverHttps \
--statement-id apigateway-prod-2 --action lambda:InvokeFunction \
--principal apigateway.amazonaws.com \
--source-arn "arn:aws:execute-api:$REGION:$ACCOUNT:$API/prod/POST/DynamoDBManager"
Here is the add-permission API docs.

An error occurred (InvalidParameterValue) when calling the RunInstances operation: Value () for parameter groupId is invalid. The value cannot be empt

I'm getting error when creating ec2 instance from my ami:
aws ec2 run-instances --image-id ami-3e21ed44 --count 1 --instance-type t2.medium --key-name sssoft --security-groups launch-wizard-4
Isn't this example same as in here?
It is giving this error:
An error occurred (InvalidParameterValue) when calling the RunInstances operation: Value () for parameter groupId is invalid. The value cannot be empty
What is wrong?
The error means the security group launch-wizard-4 does not exist in your account.
If that security group does exist in your account, check the AWS CLI profile you're using. It uses default by default. But if you need to use a different profile, just add --profile my-profile-name to the command.
For more information on profiles: AWS CLI Named Profiles
Silly mistake. In the command line the default zone was different from that of the AMI

Resources