Archive

Posts Tagged ‘AWS’

Docker Installation in Ubuntu 16.04

June 20, 2020 Leave a comment

Docker version check
$ docker –version

Set up the repository
Update the apt package index and install packages to allow apt to use a repository over HTTPS:

$ sudo apt-get update

$ sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common

Add Docker’s official GPG key:

$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add –

Verify that you now have the key with the fingerprint

$ sudo apt-key fingerprint 0EBFCD88

Add the Docker repository to APT sources:

$ sudo add-apt-repository “deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable”
$ sudo apt-get update

Make sure you are about to install from the Docker repo instead of the default Ubuntu 16.04 repo:

$ apt-cache policy docker-ce

Install Docker Engine
$ sudo apt-get install -y docker-ce

Executing the Docker Command Without Sudo (Optional)

If you want to avoid typing sudo whenever you run the docker command, add your username to the docker group:
$ sudo usermod -aG docker ${USER}

$ su – ${USER}

To verify
$ id -nG

Categories: AWS Tags: ,

CloudFormation JSON script to create EC2 Instance in AWS

April 16, 2020 Leave a comment

Json script as follows;

———————————————————————————————————————————

{“Description”: “CloudFormation template for creating an ec2 instance”,
“Parameters”: {
“KeyName”: {
“Description”: “Key Pair name”,
“Type”: “AWS::EC2::KeyPair::KeyName”,
“Default”:”CFEC2KP”
},
“VPC”: {
“Type”: “AWS::EC2::VPC::Id”,
“Default”:”vpc-9d7773e7″
},
“Subnet”:{
“Type”: “AWS::EC2::Subnet::Id”,
“Default”: “subnet-a46d9a85”
},
“InstanceType”: {
“Description”: “Select one of the possible instance types”,
“Type”: “String”,
“Default”: “t2.micro”
},
“SecurityGroup”:{
“Type”: “AWS::EC2::SecurityGroup::Id”,
“Default” : “sg-751ee55a”
}
},
“Resources”:{
“Server”: {
“Type”: “AWS::EC2::Instance”,
“Properties”: {
“ImageId”: “ami-0323c3dd2da7fb37d”,
“InstanceType”: {“Ref”: “InstanceType”},
“KeyName”: {“Ref”: “KeyName”},
“SecurityGroupIds”: [{“Ref”: “SecurityGroup”}],
“Tags”: [{“Key”: “Server”,”Value”: “TestServer”}],
“SubnetId”: {“Ref”: “Subnet”}
}
}
},
“Outputs”: {
“PublicName”: {
“Value”: {“Fn::GetAtt”: [“Server”, “PublicDnsName”]},
“Description”: “Public name (connect via SSH)”
}
}
}


Note: Create keypair via AWS console and enter the name in parameter section

CloudFormation JSON script to create S3 bucket in AWS

March 29, 2020 Leave a comment

S3 bucket with public access

{
“Resources”:
{
“MohiAchuSuhas”:{
“Type” : “AWS::S3::Bucket”,
“Properties”: {
“PublicAccessBlockConfiguration” : {
“BlockPublicAcls” : “False”,
“BlockPublicPolicy” : “False”,
“IgnorePublicAcls” : “False”,
“RestrictPublicBuckets” : “False”
}
}
}
}
}

S3 bucket without public access

{
“Resources”:
{
“MohiAchuSuhas”:{
“Type” : “AWS::S3::Bucket”,
“Properties”: {
“PublicAccessBlockConfiguration” : {
“BlockPublicAcls” : “True”,
“BlockPublicPolicy” : “True”,
“IgnorePublicAcls” : “True”,
“RestrictPublicBuckets” : “True”
}
}
}
}
}

Categories: AWS, CloudFormation Tags: ,