Skip to content

Instantly share code, notes, and snippets.

@josdem
Last active July 19, 2017 20:28
Show Gist options
  • Save josdem/b980b53d0d4f42ee4902a49025f6db3a to your computer and use it in GitHub Desktop.
Save josdem/b980b53d0d4f42ee4902a49025f6db3a to your computer and use it in GitHub Desktop.
//Listing buckets
aws s3 ls
//List a bucket content
aws s3 ls s3://{BUCKET_NAME}
//Deploy a Jar file to a bucket
aws s3 cp {JAR_FILE} s3://{BUCKET_NAME}
//Create a Lambda function using s3
aws lambda create-function --function-name ${FUNCTION_NAME} --region ${REGION_NAME} --runtime java8 --role arn:aws:iam::234111904138:role/${ROLE_NAME} --handler ${PACKAGE_CLASS_NAME} --memory-size 512 --timeout 120 --code S3Bucket=${BUCKET_NAME},S3Key={FILE_NAME}
//Move a file in a s3
aws s3 mv s3://mybucket/test.txt s3://mybucket/test2.txt
//Delete a file in a s3 bucket
aws s3 rm s3://cmi.automation.inbound.itsaglposyotta/${FILE_NAME}
//List Lambda Functions
aws lambda list-functions
//Describe the log group name
aws logs describe-log-groups
//Get log-Stream by passing Log group name from above command
aws logs describe-log-streams --log-group-name /aws/lambda/nssr-transformer
//Retrieves the Logs from the stream on the standard console
aws logs get-log-events --log-group-name /aws/lambda/nssr-transformer --log-stream-name '2017/06/07/[$LATEST]749b995cff1340829be610cf8659dada'
//Update lambda code
aws lambda update-function-code --function-name ${FUNCTION_NAME} --s3-bucket ${BUCKET_NAME} --s3-key ${ZIP_NAME}
//Execute lamda function
aws lambda invoke --invocation-type Event --function-name ${FUNCTION_NAME} --region ${REGION} outputfile.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment